-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix(registration and update): Ensure UID is updated alongside Email, and case-sensitivity is honored #71
fix(registration and update): Ensure UID is updated alongside Email, and case-sensitivity is honored #71
Conversation
…e case_insensitive_keys include Email
…or case sensitivity)
I get what you're saying about the Currently, these are all the headers needed to identify a user:
If the user is authenticated by both Can we just add something like this to the before_save :sync_uid
def sync_uid
uid = email if email.changed? and provider == 'email'
end This would keep the user's |
Sure thing. Let me tweak my PR a bit. |
There you go @lynndylanhurley ! I didn't retain the |
Awesome, thx! I'll review this ASAP! |
Hey @lynndylanhurley - Was wondering if you had any feedback for this PR or lynndylanhurley/ng-token-auth#64 |
Hey @booleanbetrayal! Sorry for the delay. I haven't forgotten, I've just been super busy. I'll review + merge today for sure! |
No worries! Just let me know if you need any tweaks or anything. Thanks! |
…l_registration fix(registration and update): Ensure UID is updated alongside Email, and case-sensitivity is honored
Looks great! Thx @booleanbetrayal!!! |
Version |
Sweet. Thanks @lynndylanhurley ! |
@lynndylanhurley -
I missed a
registrations_controller::create
condition in #57 and fixed that. However, in additional testing I also discovered thatuid
was not being updated alongsideemail
address, meaning from an authentication standpoint, theuid
would never update to reflect the user's desired address change. I swore this worked at some point, but perhaps it broke recently as a result of being moreresource
friendly? I've added fixes and tests for both conditions, but it's arguable thatuid
should be abandoned entirely when using email based authentication (would require changes insessions_controller
as well any other placeuid
is explicitly referenced).I've found another problem that arises from correctly updating
uid
though, asng-token-auth
is not context-aware of these updates and will preserve the olduid
value in theauth_tokens
hash. Meaning, after updating their email address and subsequently hitting a restricted HTTP call, the user will immediately be logged out. This is something that will probably have to happen in the response interceptor logic.Let me know what your thoughts are. I can workaround it in client code as needed for now.