fix: auth/2FA — password change requires 2FA gate, admin self-deletion blocked, twofa JSON responses, per-IP email-verify budget, OptionalAuth log sanitised

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-08-22 00:34:51 +01:00
co-authored by Sisyphus
parent d03ce79c19
commit d90e25d1ff
5 changed files with 139 additions and 28 deletions
+1 -1
View File
@@ -53,7 +53,7 @@ func OptionalAuth(next http.Handler) http.Handler {
userID, role, jti, err := auth.VerifyToken(tokenString, r.Context())
if err != nil {
log.Printf("OptionalAuth: invalid token: %v", err)
log.Printf("OptionalAuth: invalid token ignored")
} else {
ctx := context.WithValue(r.Context(), UserIDKey, userID)
ctx = context.WithValue(ctx, UserRoleKey, role)