-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: allows deleted users to signup with same email #5924
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
fix: allows deleted users to signup with same email #5924
Conversation
1d3d69c to
3cdd126
Compare
|
@uds5501 @mrsaicharan1 @iamareebjamal everything is working fine but when I update the email of user in |
app/api/helpers/user.py
Outdated
| if userEmail.endswith('.deleted'): | ||
| userEmail = userEmail[:-8] | ||
| else: | ||
| userEmail = userEmail + '.new' |
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.
Why?
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.
Suppose a user is restored but he/she already signed up so the constraint is violated as 2 users cannot have same email. So I just added a '.new' to the email just for this sake.
This case however may happen only once or twice
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 should not be automated. Admin should first change the email manually to something and then restore
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.
@iamareebjamal I'll remove this condition and if you want I can open a separate issue to handle this.
when I update the email of user in modify_email_for_user_to_be_restored function, it is not getting reflected on database
In the meantime can you please give this a look? ^^
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.
@iamareebjamal any help?
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.
Will look tomorrow. @prateekj117 @uds5501 Can you please take a look 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.
@iamareebjamal @shreyanshdwivedi will take a look tonight
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.
@shreyanshdwivedi The code looks correct. Any error logs during implementation?
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.
No error logs. @uds5501
@iamareebjamal can you take a look as well please
Codecov Report
@@ Coverage Diff @@
## development #5924 +/- ##
===============================================
- Coverage 66.48% 66.37% -0.11%
===============================================
Files 286 287 +1
Lines 13933 13969 +36
===============================================
+ Hits 9263 9272 +9
- Misses 4670 4697 +27
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## development #5924 +/- ##
===============================================
- Coverage 66.46% 66.35% -0.11%
===============================================
Files 284 285 +1
Lines 13907 13941 +34
===============================================
+ Hits 9243 9251 +8
- Misses 4664 4690 +26
Continue to review full report at Codecov.
|
858b1b0 to
9ee663f
Compare
52a74da to
fc2c4d8
Compare
|
@iamareebjamal @uds5501 I've fixed the issue due to which the email was not getting restored while restoring the user. Also, I've added a migration file to update the email of past deleted users. |
|
@iamareebjamal @CosmicCoder96 please review this :) |
1ea3e5e to
40b9e0c
Compare
|
@iamareebjamal please take a look at the updated conditions and review the PR :) |
53fc927 to
dbb4076
Compare
4f105e6 to
143d995
Compare
|
@iamareebjamal please review. I've updated the conditions |
f6c437f to
85d39f6
Compare
|
@iamareebjamal removed the duplicate error message. Please review |
uds5501
left a comment
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 looks good 👍
app/api/helpers/user.py
Outdated
| """ | ||
| user_email = user.email | ||
| if user_email.endswith('.deleted'): | ||
| remove_str = '.deleted' |
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.
Move this statement a line above and replace '.deleted' with remove_str in if statement. That was the point of extracting it to a variable
6c8199c to
fb1bf51
Compare
|
@iamareebjamal updated the PR. Please review |
|
Build is failing |
|
@iamareebjamal this is some random failure and I don't understand the cause 😅 |
|
Multiple Migration Heads. Not a random error |
|
@shreyanshdwivedi It failed again. OH. kindly change the |
215e473 to
25c89d1
Compare
fixed hound issues updates the condition for restoring user Adds migration file to update email of all deleted users updates condition for modify_email_for_user_to_be_restored
|
@uds5501 yep. Was fixing that only 😅 |
|
https://github.com/fossasia/open-event-server/blob/development/scripts/test_multiple_heads.sh is not working correctly. Open an issue |
|
@iamareebjamal tests passed. Please merge |
Fixes #5889
Checklist
developmentbranch.Short description of what this resolves:
Currently, if a user deletes his/her account or the account is deleted by an admin, he/she can't signup with same email.
Changes proposed in this pull request:
.deletedto a user's email which is to be deleted.deletedfrom user's email which is to be restored.