Skip to content

fix(auth): store has_password and has_totp flags in user info - #285

Open
hashbk wants to merge 2 commits into
mainfrom
fix/store-has-password-has-totp-flags
Open

fix(auth): store has_password and has_totp flags in user info#285
hashbk wants to merge 2 commits into
mainfrom
fix/store-has-password-has-totp-flags

Conversation

@hashbk

@hashbk hashbk commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Store has_password and has_totp as boolean flags inside the user info JSON when the password or TOTP is set
  • The frontend already expects these fields; the backend was not providing them

Approach

Instead of computing has_password/has_totp at query time (which would require loading select:false columns like password and tfaSecret on every request), store them as flags in the info JSON at the point of change. They are then returned naturally via getUserInfo() with no extra queries.

Changes

  • user.entity.ts — add has_password and has_totp to UserInfo interface
  • auth.service.ts — set has_password = true on registration
  • user.service.ts — set has_password on createUser, inviteUser, acceptInvitation, changePassword
  • oidc.service.ts — set has_password = false on OIDC user creation
  • ldap.service.ts — set has_password = false on LDAP user creation
  • auth-tfa.service.ts — set has_totp = true on TFA bind, has_totp = false on TFA disable

hashbk added 2 commits August 9, 2026 19:58
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.
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.

1 participant