-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #341 from alphagov/remove-old-user-creation-tokens
Remove old user creation tokens
- Loading branch information
Showing
4 changed files
with
41 additions
and
33 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,46 @@ | |
|
||
Records breaking changes from major version bumps | ||
|
||
## 30.0.0 | ||
|
||
PR: [#341](https://github.com/alphagov/digitalmarketplace-utils/pull/341) | ||
|
||
### What changed | ||
|
||
We don't need to add the user role to tokens when decoding them since now we're using the "send_user_account_email" function to create tokens and the user role should be passed in to that function. | ||
|
||
### Example app changes | ||
|
||
Old token creation: | ||
``` | ||
token = generate_token( | ||
{ | ||
"role": "supplier", | ||
"supplier_id": 1234, | ||
"supplier_name": "Supplier Name", | ||
"email_address": "[email protected]" | ||
}, | ||
current_app.config['SHARED_EMAIL_KEY'], | ||
current_app.config['INVITE_EMAIL_SALT'] | ||
) | ||
``` | ||
New token creation: | ||
``` | ||
send_user_account_email( | ||
'supplier', | ||
"[email protected]", | ||
current_app.config['NOTIFY_TEMPLATES']['invite_contributor'], | ||
extra_token_data={ | ||
'supplier_id': 1234, | ||
'supplier_name': "Supplier Name" | ||
}, | ||
personalisation={ | ||
'user': "Name", | ||
'supplier': "Supplier Name" | ||
} | ||
) | ||
``` | ||
|
||
## 29.0.0 | ||
|
||
PR: [#339](https://github.com/alphagov/digitalmarketplace-utils/pull/339) | ||
|
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
import flask_featureflags # noqa | ||
|
||
|
||
__version__ = '29.0.0' | ||
__version__ = '30.0.0' |
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 |
---|---|---|
|
@@ -189,34 +189,6 @@ def test_decode_invitation_token_returns_an_error_and_role_if_token_expired(emai | |
assert decode_invitation_token(token) == {'error': 'token_expired', 'role': 'supplier'} | ||
|
||
|
||
def test_decode_invitation_token_adds_the_role_key_to_old_style_buyer_tokens(email_app): | ||
data = {'email_address': '[email protected]'} | ||
token = generate_token(data, 'Key', 'Salt') | ||
|
||
with email_app.app_context(): | ||
assert decode_invitation_token(token) == { | ||
'email_address': '[email protected]', | ||
'role': 'buyer' | ||
} | ||
|
||
|
||
def test_decode_invitation_token_adds_the_role_key_to_old_style_supplier_tokens(email_app): | ||
data = { | ||
'email_address': '[email protected]', | ||
'supplier_id': 1234, | ||
'supplier_name': 'A. Supplier', | ||
} | ||
token = generate_token(data, 'Key', 'Salt') | ||
|
||
with email_app.app_context(): | ||
assert decode_invitation_token(token) == { | ||
'email_address': '[email protected]', | ||
'supplier_id': 1234, | ||
'supplier_name': 'A. Supplier', | ||
'role': 'supplier' | ||
} | ||
|
||
|
||
def test_decode_invitation_token_adds_the_role_key_to_expired_old_style_buyer_tokens(email_app): | ||
with freeze_time('2015-01-02 03:04:05'): | ||
data = {'email_address': '[email protected]'} | ||
|