-
Notifications
You must be signed in to change notification settings - Fork 55
Return M_USER_LOCKED
error when logging in with a locked account on the compatibility endpoints
#4789
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
Conversation
Deploying matrix-authentication-service-docs with
|
Latest commit: |
6183cae
|
Status: | ✅ Deploy successful! |
Preview URL: | https://60a93d42.matrix-authentication-service-docs.pages.dev |
Branch Preview URL: | https://af-user-locked-errors.matrix-authentication-service-docs.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing major, thanks for this!
browser_session.id = %browser_session_id, | ||
"Attempt to exchange login token but browser session is not active" | ||
); | ||
return Err(RouteError::InvalidLoginToken); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more readable to check if the user is locked earlier
if browser_session.user.locked_at.is_some() {
return Err(RouteError::UserLocked);
}
if !browser_session.active() || !browser_session.user.is_valid() {
// ...
}
It changes a little bit what error we show in what condition, but it's an edge-case anyway, as usually we would show a user comprehensible error earlier in the UI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I've reverted this with 05827d1 (the commit message explains why). The logic is more precise this time, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, works for me!
Also update snapshots for token values affected by state changes
d31af23
to
82e3ea6
Compare
When a user is both locked and deactivated, give precedence to deactivation errors over locked errors, as a locked error suggests that unlocking the user would make it available.
M_USER_LOCKED
error when logging in with a locked account on the compatibility endpoints
No description provided.