mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 04:36:48 +00:00
feat(accounts): force a password change at the first login with the generated password
While data/admin_password exists and a user's password still matches it, the login sets a session flag (checked once at login, not per request). ForcePasswordChangeMiddleware then sends that user to the password-change page for every view except change password, login and logout. Setting a new password clears the flag and deletes data/admin_password. No schema change; if ADMIN_PASSWORD was set, there is no file and nothing is forced.
This commit is contained in:
parent
40822e7184
commit
78852eb4c8
6 changed files with 114 additions and 6 deletions
|
|
@ -79,6 +79,7 @@ MIDDLEWARE = [
|
|||
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
||||
"django_otp.middleware.OTPMiddleware",
|
||||
"login_required.middleware.LoginRequiredMiddleware",
|
||||
"accounts.middleware.ForcePasswordChangeMiddleware",
|
||||
"django.contrib.auth.middleware.RemoteUserMiddleware",
|
||||
"django.contrib.messages.middleware.MessageMiddleware",
|
||||
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue