Creating an account through the admin UI means the administrator picks the
password, so the owner starts life with a secret someone else knows. Nothing
in the UI said so: the password form existed, but nobody was sent to it.
- identity: accounts carry must_change_password, set on admin creation and
cleared once the owner changes the password themselves
- POST /login returns the flag so the client can act on it right away
- GET /profile exposes it for the profile page
- web: after login, a flagged account goes straight to /profile, which shows
why; the banner disappears once the change succeeds
Backend tests cover both directions: a successful change clears the flag, a
failed one (wrong current password) leaves it alone.
Two gaps surfaced while running DeepTutor for a staff roster:
1. No endpoint changed a password. The service layer already had
identity.set_password(), but nothing exposed it, so an account whose
password was lost could only be fixed by editing users.json by hand.
- PUT /api/auth/profile/password (self-service, verifies the current
password so a stolen session alone cannot take the account over)
- PUT /api/auth/users/{username}/password (admin reset, require_admin)
2. The username validator only accepted [A-Za-z0-9_-.]{3,64}, so real
names such as 于冬阳 were rejected — with an error message that said
'enter a valid email address', which pointed at the wrong problem.
CJK-only names now allow two characters (张伟) where Latin usernames
still require three (abc); the message names both accepted forms.