-
Notifications
You must be signed in to change notification settings - Fork 156
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
feat(recoverable): Add support for username recovery via simple login flows #1041
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
87ef66f
add support for username recovery
jamesejr 7ae5671
default username recovery to false
jamesejr c92f69c
add support for json and generic responses
jamesejr dbb8d7b
Merge branch 'main' into username-recovery
jamesejr b2228b0
fix json support and api docs
jamesejr 31a8ad2
fix docs and add context processor tests
jamesejr 600d7ee
Merge branch 'main' into username-recovery
jamesejr 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 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 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 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 |
---|---|---|
|
@@ -1155,6 +1155,38 @@ Recoverable | |
|
||
Default: ``_("Your password has been reset")``. | ||
|
||
.. py:data:: SECURITY_USERNAME_RECOVERY | ||
|
||
Specifies whether username recovery is enabled. | ||
|
||
Default: ``False``. | ||
|
||
.. versionadded:: 5.6.0 | ||
|
||
.. py:data:: SECURITY_USERNAME_RECOVERY_URL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add this to list of URLs below |
||
|
||
Specifies the username recovery URL. | ||
|
||
Default: ``"/recover-username"``. | ||
|
||
.. versionadded:: 5.6.0 | ||
|
||
.. py:data:: SECURITY_EMAIL_SUBJECT_USERNAME_RECOVERY | ||
|
||
Sets subject for the username recovery email. | ||
|
||
Default: ``_("Your requested username")``. | ||
|
||
.. versionadded:: 5.6.0 | ||
|
||
.. py:data:: SECURITY_USERNAME_RECOVERY_TEMPLATE | ||
|
||
Specifies the path to the template for the username recovery page. | ||
|
||
Default: ``"security/recover_username.html"``. | ||
|
||
.. versionadded:: 5.6.0 | ||
|
||
Change-Email | ||
------------ | ||
.. versionadded:: 5.5.0 | ||
|
@@ -1935,6 +1967,7 @@ A list of all templates: | |
* :py:data:`SECURITY_TWO_FACTOR_VERIFY_CODE_TEMPLATE` | ||
* :py:data:`SECURITY_TWO_FACTOR_SELECT_TEMPLATE` | ||
* :py:data:`SECURITY_TWO_FACTOR_SETUP_TEMPLATE` | ||
* :py:data:`SECURITY_USERNAME_RECOVERY_TEMPLATE` | ||
* :py:data:`SECURITY_US_SIGNIN_TEMPLATE` | ||
* :py:data:`SECURITY_US_SETUP_TEMPLATE` | ||
* :py:data:`SECURITY_US_VERIFY_TEMPLATE` | ||
|
This file contains 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 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 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 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 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 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 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
8 changes: 8 additions & 0 deletions
8
flask_security/templates/security/email/username_recovery.html
This file contains 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,8 @@ | ||
{# This template receives the following context: | ||
user - the entire user model object | ||
#} | ||
|
||
<p>{{ _fsdomain("Hello,") }}</p> | ||
<p>{{ _fsdomain("You recently requested to recover your username.") }}</p> | ||
<p>{{ _fsdomain("Your username is: %(username)s", username=user.username) }}</p> | ||
<p>{{ _fsdomain("If you did not initiate this request, you can safely ignore this email.") }}</p> |
8 changes: 8 additions & 0 deletions
8
flask_security/templates/security/email/username_recovery.txt
This file contains 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,8 @@ | ||
{# This template receives the following context: | ||
user - the entire user model object | ||
#} | ||
|
||
{{ _fsdomain("Hello,") }} | ||
{{ _fsdomain("You recently requested to recover your username.") }} | ||
{{ _fsdomain("Your username is: %(username)s", username=user.username) }} | ||
{{ _fsdomain("If you did not initiate this request, you can safely ignore this email.") }} |
Oops, something went wrong.
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.
Given this is a separate feature - could you put this is its own 'section'