Add change password functionality for users

Introduces a change password route, form, and template, allowing authenticated users to update their password. Updates the User model with a method to set the must_change_password flag. Adjusts login and navigation logic to support the new flow and ensures users are redirected to change their password if required.
This commit is contained in:
2025-08-11 18:03:18 +02:00
parent 0da580faf1
commit 97ff4acf02
7 changed files with 86 additions and 6 deletions

View File

@@ -36,6 +36,9 @@ class User(UserMixin, db.Model):
def change_password(self, password: str) -> None:
self.password = generate_password_hash(password=password)
def set_pw_change(self, change: bool) -> None:
self.must_change_password = change
class Unit(db.Model):
__tablename__ = "unit"