mirror of
https://github.com/StefBuwalda/cal_counter.git
synced 2025-10-29 19:00:00 +00:00
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:
13
forms.py
13
forms.py
@@ -11,7 +11,18 @@ from wtforms.validators import DataRequired, InputRequired, Optional
|
||||
class LoginForm(FlaskForm):
|
||||
username = StringField("Username", validators=[DataRequired()])
|
||||
password = PasswordField("Password", validators=[DataRequired()])
|
||||
submit = SubmitField("auth.login")
|
||||
submit = SubmitField("Log in")
|
||||
|
||||
|
||||
class ChangePasswordForm(FlaskForm):
|
||||
current_password = PasswordField(
|
||||
"Current password", validators=[DataRequired()]
|
||||
)
|
||||
new_password = PasswordField("New password", validators=[DataRequired()])
|
||||
confirm_password = PasswordField(
|
||||
"Confirm new password", validators=[DataRequired()]
|
||||
)
|
||||
submit = SubmitField("Change password")
|
||||
|
||||
|
||||
class FoodItemForm(FlaskForm):
|
||||
|
||||
Reference in New Issue
Block a user