fix(auth): store has_password and has_totp flags in user info - #285
Open
hashbk wants to merge 2 commits into
Open
fix(auth): store has_password and has_totp flags in user info#285hashbk wants to merge 2 commits into
hashbk wants to merge 2 commits into
Conversation
The frontend expects has_password and has_totp inside the user info object, but the backend was not providing them. Store these as flags in the info JSON when the password or TOTP is set, so they are returned naturally via getUserInfo() without loading select:false columns.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
has_passwordandhas_totpas boolean flags inside the userinfoJSON when the password or TOTP is setApproach
Instead of computing
has_password/has_totpat query time (which would require loadingselect:falsecolumns likepasswordandtfaSecreton every request), store them as flags in theinfoJSON at the point of change. They are then returned naturally viagetUserInfo()with no extra queries.Changes
user.entity.ts— addhas_passwordandhas_totptoUserInfointerfaceauth.service.ts— sethas_password = trueon registrationuser.service.ts— sethas_passwordon createUser, inviteUser, acceptInvitation, changePasswordoidc.service.ts— sethas_password = falseon OIDC user creationldap.service.ts— sethas_password = falseon LDAP user creationauth-tfa.service.ts— sethas_totp = trueon TFA bind,has_totp = falseon TFA disable