-
Notifications
You must be signed in to change notification settings - Fork 0
HIDP-280 as a user i want to be able to change my email address using #376
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: feature/api
Are you sure you want to change the base?
HIDP-280 as a user i want to be able to change my email address using #376
Conversation
|
I looked at the custom url logic for the mailers and will implement similar logic in related PRs. Some thoughts:
But overal it seems like the most straightforward implementation and seems to be in line with other packages. |
Yeah I also didn't love "template" for the same reason but wanted to communicate that one is a simple url string and the other needs the interpolation/replacement field. But as long as the checks exist I'm fine with removeing the "_template"
I actually would like to kind of go the other direction in future as I'd like to separate view logic from business logic more. And which url to use depending on whether the its the API or html views is view logic while the actual mail sending is business logic. At least to me. |
…to-change-my-email-address-using # Conflicts: # packages/hidp/docs/openapi/schema.json # packages/hidp/hidp/api/serializers.py # packages/hidp/hidp/api/urls.py # packages/hidp/hidp/api/views.py # packages/hidp/tests/unit_tests/test_api/test_serializers.py
…to-change-my-email-address-using # Conflicts: # packages/hidp/hidp/api/urls.py # packages/hidp/hidp/api/views.py
|
|
||
| if ( | ||
| not token_data | ||
| or not set(token_data.keys()) == {"recipient", "uuid"} |
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.
Not wrong to check if this is true, but different from the view based implementation. If we refactor stuff perhaps should move this check to EmailChangeTokenMixin.validate_token_data and make the mixin more general
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.
I think it's a good thing to look at this again during a future refactor.
| ): | ||
| authentication_classes = [SessionAuthentication] | ||
| permission_classes = [IsAuthenticated] | ||
| serializer_class = EmailChangeSerializer |
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.
For consistency (and perhaps for allowing overrides) we should use setting class variables for:
token_generator = tokens.email_change_token_generator
email_change_request_mailer = mailers.EmailChangeRequestMailer
proposed_email_exists_mailer = mailers.ProposedEmailExistsMailer
These things might move in a similar way to a mixin in the future 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.
For now I've not considered how friendly the endpoints are to subclassing/overriding, so I decided to not support that functionality either. After all the API endpoints already are structured differently compared to the views with all their mixins. So similar to this comment, I suggest looking at this again during a possible future refactor.
…to-change-my-email-address-using # Conflicts: # packages/hidp/docs/openapi/schema.json # packages/hidp/hidp/api/urls.py # packages/hidp/hidp/api/views.py # packages/hidp/hidp/config/checks.py # packages/hidp/hidp/spectacular_settings.py # packages/hidp/tests/test_settings.py # project/hidp_sandbox/settings.py # project/tests/test_settings.py
/api/email-change/POSTcreates new email change requests and sends the appropriate emails (to the current and proposed email addresses)DELETEcancels an existing email change request/api/email-change-confirm/PUTconfirms the email change request using the tokens sent in the emails from creating the email change requestget_object()method andPATCHshould not be added (which is done automatically by theUpdateModelMixin).