-
Notifications
You must be signed in to change notification settings - Fork 21
Allow users to change their own email and make password changing easier #616
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
base: master
Are you sure you want to change the base?
Changes from all commits
9101b74
44fafe6
fedba5b
7c0f4e8
a037075
66cf9d6
064b2d8
4505144
75ef6fa
efd03c6
fc64abc
b6c2c4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,10 @@ class MulysaOAuth2Validator(OAuth2Validator): | |
|
|
||
| def get_additional_claims(self, request): | ||
| """ | ||
| give email, firstname and lastname in oid claims data | ||
| give sub, email, firstname and lastname in oid claims data | ||
| """ | ||
| return { | ||
| "sub": request.user.email, | ||
| "sub": request.user.oidc_sub, | ||
|
Member
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. What if we add the uuid for everybody (a real uuid, not "some users have uuid some email") and a "useLegacySSOIdentifier" bit. In the migration generate uuid for everybody and mark the old users with the "use legacy" bit. Then have a property decorator "ssoidentifier" that returns either the uuid or the email depending on the users legacy bit. This would be cleaner from db perspective and might allow for easier migration in the long run. |
||
| "email": request.user.email, | ||
| "firstName": request.user.first_name, | ||
| "lastName": request.user.last_name, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by Django 5.1.9 on 2025-10-01 02:44 | ||
|
|
||
| import users.models.custom_user | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("users", "0030_alter_banktransaction_unique_together_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="customuser", | ||
| name="oidc_sub", | ||
| field=models.CharField( | ||
| default=users.models.custom_user.get_uuid_str, | ||
| editable=False, | ||
| max_length=255, | ||
| null=True, | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||
| # Generated by Django 5.1.9 on 2025-10-01 02:45 | ||||||||||
|
|
||||||||||
| from django.db import migrations | ||||||||||
|
|
||||||||||
| # Note there is a race condition if you allow objects to be created while this migration is running. | ||||||||||
| # Objects created after the AddField and before RunPython will have their original uuid’s overwritten. | ||||||||||
|
Comment on lines
+5
to
+6
|
||||||||||
| # Note there is a race condition if you allow objects to be created while this migration is running. | |
| # Objects created after the AddField and before RunPython will have their original uuid’s overwritten. | |
| # IMPORTANT: There is a race condition if you allow objects to be created while this migration is running. | |
| # To prevent data corruption, you MUST run this migration during a maintenance window when object creation is disabled. |
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.
Maybe? This comment is a result of copy pasting directly from Django docs. I was under the impression that migrations are run at server startup before any object creation is possible.
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.
Usually migrations are ran before the service is started.
But if you have hundreds of workers running with "internet scale" traffic then the correct way is to first deploy a version that can handle both situations. Then the migration that can run in the background without downtime. Then a new version that has just the new logic. And all of this would happen in a way that first just some traffic, say 10% is sent to the new workers and after verifying it works then the rest of the traffic in few batches.
No we are not nowhere near that kind of requirements here :)
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.
Usually migrations are ran before the service is started.
But if you have hundreds of workers running with "internet scale" traffic then the correct way is to first deploy a version that can handle both situations. Then the migration that can run in the background without downtime. Then a new version that has just the new logic. And all of this would happen in a way that first just some traffic, say 10% is sent to the new workers and after verifying it works then the rest of the traffic in few batches.
No we are not nowhere near that kind of requirements here :)
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by Django 5.1.9 on 2025-10-01 02:45 | ||
|
|
||
| import users.models.custom_user | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("users", "0032_customuser_populate_oidc_sub_values"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="customuser", | ||
| name="oidc_sub", | ||
| field=models.CharField( | ||
| default=users.models.custom_user.get_uuid_str, | ||
| editable=False, | ||
| max_length=255, | ||
| unique=True, | ||
| ), | ||
| ), | ||
| ] |
Uh oh!
There was an error while loading. Please reload this page.