Skip to content
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 MFA authentication page error: handle user read permissions #1802

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

KinyaElGrande
Copy link
Contributor

Ref: #1782

}

d["user"] = user
d["user"] = req.AuthUser.User
d["theme"] = user.Meta.Theme
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason you did not change to req.AuthUser here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the reason is req.AuthUser doesn't have the most updated data.

return nil

// check if err is not nil and cater for MFA by checking if the error is not allowed to read
if err != nil && !errors.Is(err, service.UserErrNotAllowedToRead()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens when there is a UserErrNotAllowedToRead error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case, since we have the User details from req.AuthUser and we're searching for the most updated users data, the UserErrNotAllowedToRead is ignored.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless maybe we don't want the current user's theme to be applied on MFA login screen, then we can handle it the same way we handle other errors.

if err != nil {
return nil

service.CurrentSettings.Privacy.Mask.Email = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how do you know this was true before in all cases? maybe just use a temp variable

@KinyaElGrande KinyaElGrande force-pushed the 2023.9.x-fix-mfa-authentication-login-page branch from 7bce2ab to cd6b849 Compare June 5, 2024 15:01
@KinyaElGrande KinyaElGrande merged commit 838f4ad into 2023.9.x Jun 5, 2024
12 checks passed
@KinyaElGrande KinyaElGrande deleted the 2023.9.x-fix-mfa-authentication-login-page branch June 5, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When I log in with a user who has enabled 2 factor authentication I get a template: mfa.html.tpl:1:34 error
2 participants