Introduce avatar and banner and fetch Gravatar to fill avatar during registration

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

typo

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Rename avatar to avatar_url, same with header.

Add a comment to explain why the tweak with HTTPoison and TLS1.2

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

Rename avatar to avatar_url

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

rename old avatar properties in front-end to avatar_url

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

fix change gravatar from ?d= to ?default=

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

reorganize aliases and imports

Signed-off-by: Thomas Citharel <tcit@tcit.fr>

set avatar url only when gravatar exists, add a test for that case

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2018-01-26 11:02:11 +01:00
parent 35492570de
commit 4b4ecec693
11 changed files with 71 additions and 23 deletions

View File

@@ -6,7 +6,6 @@ defmodule Eventos.Accounts.User do
import Ecto.Changeset
alias Eventos.Accounts.{Account, User}
schema "users" do
field :email, :string
field :password_hash, :string
@@ -31,9 +30,12 @@ defmodule Eventos.Accounts.User do
|> changeset(params)
|> cast(params, ~w(password)a, [])
|> validate_length(:password, min: 6, max: 100)
|> hash_password
|> hash_password()
end
@doc """
Hash password when it's changed
"""
defp hash_password(changeset) do
case changeset do
%Ecto.Changeset{valid?: true,
@@ -45,5 +47,4 @@ defmodule Eventos.Accounts.User do
changeset
end
end
end