-
Notifications
You must be signed in to change notification settings - Fork 183
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
for MPP-3817: prevent all Relay operations when user.is_active = False #4709
Conversation
🔍 Existing Issues For ReviewYour pull request is modifying functions with the following pre-existing issues: 📄 File: emails/views.py
Did you find this useful? React with a 👍 or 👎 |
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.
Thanks @groovecoder for the extensive code to prevent Relay operations for users that are not active. Changes look good with some minor suggestions in review. Also some additional suggestions:
- (blocking) We are missing the
is_active
check on_reply_allowed
- (non-blocking) Can we refactor to add the
is_active
check in thehas_premium
check instead?
|
||
user.is_active = False | ||
user.save() | ||
msg = "SUCCESS: deactivated user." |
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.
(suggestion, blocking) Descriptive success message with the identifier key and value for better logging.
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.
(question) Should we consider a place to log why the account was deactivated as well?
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.
Updated message with identifier key and value.
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.
Code changes look good. While manually running tests I noted:
- Instruction uses
python manage.py deactivate_user_by_token
it should bepython manage.py deactivate_user
instead - (blocking) After deactivating the user and while signed-in I get the following error:
NoReverseMatch at /accounts/fxa/login/callback/
Reverse for 'account_inactive' not found. 'account_inactive' is not a valid view function or pattern name.
Seems like allauth tries to send the user to the "account_inactive" page and fails because we have no view setup for that.
Were you using http://127.0.0.1:8000 or http://localhost:3000? |
I've only enabled some of the allauth endpoints: fx-private-relay/privaterelay/urls.py Lines 30 to 38 in b961ce0
You'll need to enable more of them, or all of them. I disabled most because we have proper Django-side template to render them, or support features like a second social account. This way the user would get a 404 instead of a 500. |
@groovecoder, I was using http://127.0.0.1:8000. Does it work for you? For me, adding |
In 59a8b4f I added a new |
59a8b4f
to
f937381
Compare
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 PR fixes #MPP-3817.
How to test:
python manage.py deactivate_user
a number of ways (See--help
for details)Note: some tests may be easiest on the dev server.
l10n changes have been submitted to the l10n repository, if any./frontend/src/styles/tokens.scss
).