add MFA, user web mail portal

This commit is contained in:
2026-08-13 08:07:19 +01:00
parent 70c05cc777
commit bc4bbe6e56
38 changed files with 1072 additions and 59 deletions
+3 -1
View File
@@ -17,7 +17,9 @@ import (
func (a *App) accountPage(w http.ResponseWriter, r *http.Request) {
user := userFromContext(r)
creds, _ := a.DB.ListWebAuthnCredentials(user.ID)
a.render(w, r, "account.html", M{"active": "account", "user": user, "passkeys": creds})
hasMFA := user.TOTPEnabled || len(creds) > 0
mfaRequired := !hasMFA && a.Cfg.Section("Auth").Key("enforce_admin_mfa").MustBool(false)
a.render(w, r, "account.html", M{"active": "account", "user": user, "passkeys": creds, "mfa_required": mfaRequired})
}
// changePassword mirrors a normal (not forced) password change from account settings.