Skip to content

Commit

Permalink
parse email attribute, #29
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Dec 4, 2019
1 parent 0b7ad81 commit 4a7f135
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/app/ctx/person.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ defmodule App.Ctx.Person do
end

@doc false
def changeset(%{email: email} = person, attrs) do
def changeset(person, %{"email" => email} = attrs) do
person
|> cast(attrs, [:username, :email, :givenName, :familyName, :password_hash, :key_id, :locale, :picture])
|> validate_required([:username, :email, :givenName, :familyName, :password_hash, :key_id])
|> put_change(:email_hash, email )
end

def google_changeset(%{email: email} = profile, attrs) do
def google_changeset(profile, %{"email" => email} = attrs) do
profile
|> cast(attrs, [:email, :givenName, :familyName, :picture, :locale])
|> validate_required([:email])
Expand Down
4 changes: 0 additions & 4 deletions lib/app_web/controllers/google_auth_controller.ex
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
defmodule AppWeb.GoogleAuthController do
use AppWeb, :controller
# use AppWeb, :router
alias AppWeb.Router.Helpers
alias App.Ctx.Session
# alias App.Repo

@elixir_auth_google Application.get_env(:app, :elixir_auth_google) || ElixirAuthGoogle

Expand Down

0 comments on commit 4a7f135

Please sign in to comment.