-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Add change password and forgot my password #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
2cf26ed
feat: Add registration page
orronai 3913a5e
feat: Add registration page
orronai d206c6a
Fixed sourcey-ai issues
orronai 6ad4d4d
fixed resend email confirmation
orronai 5acbda2
Merge branch 'master' of https://github.com/PythonFreeCourse/lms into…
orronai 6b137af
Added translations
orronai 3798a2d
Removed unused module
orronai 1377e9a
Changed versions of requirements
orronai 93da860
Changed versions of requirements
orronai ec52300
Changed versions of requirements
orronai 4e47d57
Changed versions of requirements
orronai 8d08863
Changed versions of requirements
orronai 366b53f
Changed versions of requirements
orronai 1443bad
Removed versions change
orronai 1d00a27
Fixed tests
orronai 036bdf5
Fixed a test
orronai b426102
Fixed test and updated client fixture
orronai c2ffa37
Added tests for coverage
orronai a9c22c9
Merge branch 'master' into add-signup-page
orronai b8dff02
- Changed role name from not_confirmed into unverified
orronai 2da74c3
Fixed conflict
orronai fda1558
Added a test for signature expired
orronai 6ad81a2
Removed unnecessary condition
orronai eb717f1
Added role attribute
orronai 7e87dad
- Fixed babel translations
orronai 19ecb65
Fixed a test to check bad signature token
orronai 71fbb2f
Fixed a test
orronai d4bd32a
Moved out the HASHED_PASSWORD in order to be global variable, and add…
orronai 436fc9f
Added a configuration of registration open, and a test
orronai 1c45f57
feat: Add change password page
orronai ce3d5f8
feat: Add change password
orronai 647378f
Added a comma
orronai e6dcbd5
Added a comma
orronai 505d187
- Moved the send mails methods into utils/mail.py
orronai e65511c
Added a test for invalid_tries change password
orronai f2e5b0f
Added a test for invalid_tries change password
orronai c4621fd
Added a test for invalid_tries change password
orronai 9e1bd57
- Added forgot my password template and css style
orronai 1d27a18
Fixed some changes requested
orronai 14d8f2b
Fixed translations
orronai 0670c7e
Fixed some issues
orronai 786527b
Changed session token to be uuid
orronai fa76fdf
Added a test and changed get_or_none to get
orronai ee88ddd
fix: check test send mail
orronai 3a005f4
Added skipif for sending mail test and split a test function
orronai e3e633d
Changed skipif condition and split a test
orronai 85c91c7
fix: test mails
orronai 97827c1
Removed unused import
orronai e1651c7
Changed fixture to be session instead of class scope
orronai 418437d
changed some code style and changed uuidfield
orronai fa56e55
Add migration
orronai e7e8043
feat: add migration
orronai 33da242
fix: bool expression
orronai d6c94b2
Merge branch 'master' of https://github.com/PythonFreeCourse/lms into…
orronai 1ca6102
Changed html name files
orronai 2ffbeed
Removed unused imports and moved out to conftest some client.post's
orronai 7153c46
Removed TestResponse objects
orronai 40b65a1
Merge branch 'master' into add-change-password
yammesicka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from flask import session | ||
from flask_babel import gettext as _ # type: ignore | ||
from flask_wtf import FlaskForm | ||
from wtforms import PasswordField | ||
from wtforms.validators import EqualTo, InputRequired, Length, ValidationError | ||
|
||
from lms.lmsweb.config import MAX_INVALID_PASSWORD_TRIES | ||
|
||
|
||
class ChangePasswordForm(FlaskForm): | ||
current_password = PasswordField( | ||
'Password', validators=[InputRequired(), Length(min=8)], id='password', | ||
) | ||
password = PasswordField( | ||
'Password', validators=[InputRequired(), Length(min=8)], id='password', | ||
) | ||
confirm = PasswordField( | ||
'Password Confirmation', validators=[ | ||
InputRequired(), | ||
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')), | ||
], | ||
) | ||
|
||
def __init__(self, user, *args, **kwargs): | ||
super(ChangePasswordForm, self).__init__(*args, **kwargs) | ||
self.user = user | ||
|
||
def validate_current_password(self, field): | ||
yammesicka marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if session['_invalid_password_tries'] >= MAX_INVALID_PASSWORD_TRIES: | ||
raise ValidationError(_('הזנת סיסמה שגויה מספר רב מדי של פעמים')) | ||
if not self.user.is_password_valid(field.data): | ||
session['_invalid_password_tries'] += 1 | ||
raise ValidationError(_('הסיסמה הנוכחית שהוזנה שגויה')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from lms.lmsweb.tools.validators import EmailNotExists | ||
from flask_babel import gettext as _ # type: ignore | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField | ||
from wtforms.fields.simple import PasswordField | ||
from wtforms.validators import Email, EqualTo, InputRequired, Length | ||
|
||
|
||
class ResetPassForm(FlaskForm): | ||
email = StringField( | ||
'Email', validators=[ | ||
InputRequired(), Email(message=_('אימייל לא תקין')), | ||
EmailNotExists, | ||
], | ||
) | ||
|
||
|
||
class RecoverPassForm(FlaskForm): | ||
password = PasswordField( | ||
'Password', validators=[InputRequired(), Length(min=8)], id='password', | ||
) | ||
confirm = PasswordField( | ||
'Password Confirmation', validators=[ | ||
InputRequired(), | ||
EqualTo('password', message=_('הסיסמאות שהוקלדו אינן זהות')), | ||
], | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we save at the end of the transaction? I think it would take significantly less time