This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Allow users to click account renewal links multiple times without hitting an 'Invalid Token' page #74
Merged
Merged
Allow users to click account renewal links multiple times without hitting an 'Invalid Token' page #74
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
39dd511
Don't clear a user's renewal token after they've validated their account
anoadragon453 1a3cd45
Switch account_validity templates to read_template method
anoadragon453 57ffeb8
Add template for trying to renew an account with a previously used token
anoadragon453 3298f44
Return the new template if the user is trying to reuse a token.
anoadragon453 e4b2eb7
Modify reg tests to check re-using an existing account validity token.
anoadragon453 58300ee
Move account validity template reading to RegistrationConfig
anoadragon453 a9d4ca2
Apply suggestions from code review
anoadragon453 6d5d4a4
Change log line to be info, also log attempted token
anoadragon453 d950e33
Simplify Content-Type checking test code
anoadragon453 f8addd1
Add token_used_ts_ms column to account_validity table
anoadragon453 9e4d541
Switch to a new token_used_ts_ms db column, instead of overloading em…
anoadragon453 b06d392
mypy
anoadragon453 0f3299a
Merge branch 'dinsic' of github.com:matrix-org/synapse-dinsic into an…
anoadragon453 62b5c30
Remove email_sent from get_user_from_renewal_token return values
anoadragon453 749ea53
Remove unnecessary email_sent column from query
anoadragon453 5fc82f9
Move AccountValidityConfig to its own config file
anoadragon453 c239f78
Change account validity config option instances
anoadragon453 150e7e9
Correct test.
anoadragon453 b3a88b0
Update synapse/handlers/account_validity.py
anoadragon453 4e4b619
Allow account_validity to be None in the config
anoadragon453 ddc1a66
Define AV variables as None initially, instead of not setting them
anoadragon453 cb82e7f
Add some explanation to directly setting account_validity-related config
anoadragon453 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
<html><body>Your account is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.</body><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 |
---|---|---|
@@ -1 +1 @@ | ||
<html><body>Your account has been successfully renewed.</body><html> | ||
<html><body>Your account has been successfully renewed and is valid until {{ expiration_ts|format_ts("%d-%m-%Y") }}.</body><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
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
18 changes: 18 additions & 0 deletions
18
synapse/storage/databases/main/schema/delta/58/19account_validity_token_used_ts_ms.sql
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,18 @@ | ||
/* Copyright 2020 The Matrix.org Foundation C.I.C. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
-- Track when users renew their account using the value of the 'renewal_token' column. | ||
-- This field should be set to NULL after a fresh token is generated. | ||
ALTER TABLE account_validity ADD token_used_ts_ms BIGINT; |
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.
This is due to the
AccountValidityConfig
not being part of the huge config object that normally gets created? I wonder if there's a good reason for that.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.
Indeed, and my thought is that this class was just created to clean up
RegistrationConfig
a bit, rather than makingAccountValidityConfig
a proper config class.But I'm not sure if there's any justification against not doing so. May have to wait for people to come back to ask.
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.
We talked a bit about this and the conclusion was to attempt to make it a proper config class, but if it turns out to be too hard then to punt it.