-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: New Person inserted each time I authenticate with Google #29
Comments
Updating the tests now. Linked also to #25
So the errors are linked to endpoints created automatically (ex: creating new person). The form created was trying to display the email hashed however Phoenix wasn't able to display the hash correctly. |
The function
I think the value are different between the hash converted and the actual value inseted in the database |
I've updated the way we save the email_hash to be able to retrieve the person by email.
I think this is due to some person data not defined and required on the index template |
Hmm... can you share your screen? I'm on Zoom. |
The email attribute wasn't pattern matched on the correct parameters. It was done on the
This works however I'm wondering if there is a nicer/other way to extract the email directly from the changeset after defp put_pass_hash(changeset) do
case changeset do
%Ecto.Changeset{valid?: true, changes: %{password: pass}} ->
put_change(changeset, :password_hash, Comeonin.Pbkdf2.hashpwsalt(pass))
_ ->
changeset
end
end |
Schemas don't have the Access Behaviour, so we can't access data with |
@SimonLab good catch. thanks for fixing this. 👍 |
Using |
Minor issue: the
App.Ctx.get_person_by_email
invoked ingoogle_auth_controller.ex
does not do what we
expect
it to ...https://github.com/dwyl/app-mvp-phoenix/blob/5a9a0fddb2d908de48b2b4de9853dbcaef63a0e5/lib/app_web/controllers/google_auth_controller.ex#L15
This is never going to work in a world where the
email
field is encrypted ...(i.e. each time the email address
[email protected]
is encrypted/inserted the ciphertext is different ...)https://github.com/dwyl/app-mvp-phoenix/blob/5a9a0fddb2d908de48b2b4de9853dbcaef63a0e5/lib/app/ctx.ex#L238
The result is that a
new
person
record is inserted each time the person uses Google Auth:🙄
Todo
people
schema hasfield :email_hash, Fields.EmailHash
definedApp.Ctx.get_person_by_email/1
function to:Fields.EmailHash.dump(email)
to hash the email address before attempting to look it up.email_hash
not theemail
(Fields.EmailEncrypted
)The text was updated successfully, but these errors were encountered: