1
0
Fork 0
forked from OpenNeo/impress

Oops, fix tracking neopass_email on account creation.

My bad!
This commit is contained in:
Emi Matchu 2024-04-09 05:45:39 -07:00
parent 0a046ed9c1
commit d10c11e261

View file

@ -140,14 +140,16 @@ class AuthUser < AuthRecord
# password recovery!) # password recovery!)
email_exists = AuthUser.where(email: auth.info.email).exists? email_exists = AuthUser.where(email: auth.info.email).exists?
user.email = auth.info.email unless email_exists user.email = auth.info.email unless email_exists
# Additionally, regardless of whether we save it as `email`, we also
# save the email address as `neopass_email`, to use in the Settings UI
# to indicate what NeoPass you're linked to.
user.neopass_email = auth.info.email
end.tap do |user| end.tap do |user|
# If this account already existed, make sure we've saved the latest # If this account already existed, make sure we've saved the latest
# email to `neopass_email`. # email to `neopass_email`. (In practice, this *shouldn't* ever change
# # after initial setup, because NeoPass emails are immutable? But why
# We track this separately from `email`, which the user can edit, to # not be resilient!)
# use in the Settings UI to indicate what NeoPass you're linked to. (In
# practice, this *shouldn't* ever change after initial setup, because
# NeoPass emails are immutable? But why not be resilient!)
unless user.previously_new_record? unless user.previously_new_record?
user.update!(neopass_email: auth.info.email) user.update!(neopass_email: auth.info.email)
end end