Open MidouWebDev opened 3 years ago
Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .
@Leopold-V thanks bro
I will check this with @PraveenMalethia
@PraveenMalethia
Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .
An addition to this. Looking at the code it seems like the issue is that the 'api/users/profile_update/' endpoint, only updates the fields that are in the UserProfile model, and since the actual email is part of the django user model, it's not being updated.
Hi @MidouWebDev I think it is a backend issue because whatever we modify in the user setting page, a request is sent to the api/users/profile_update/ route and always answer with an undefined email field : https://i.gyazo.com/9f3172e087236a062e49a0c17cac74bc.png .
An addition to this. Looking at the code it seems like the issue is that the 'api/users/profile_update/' endpoint, only updates the fields that are in the UserProfile model, and since the actual email is part of the django user model, it's not being updated.
Yeah, Thanks That's what @Leopold-V also mentionned, i am waiting for @PraveenMalethia 's opinion
Oh, I see , will look at that !
i have updated the view to also modify the email field, which is of the default user model provided by Django !
@MidouWebDev Assign it to me, I'll start working on this tomorrow
@mani-barathi okey, thanks !
@MidouWebDev There is nothing to change in the frontend regarding the email update. If the user tries to update the email, we are making a proper request to the backend with the new email as a payload. But in the response, the email field is not present. I checked the backend route I think line number 248 should be after line number 256, such that response is created after the user object being updated with the new email.
@PraveenMalethia what's your thought on this?
@PraveenMalethia
check the new_email
which is received in the 'email' payload and if that is None! then it will be assigned to the user profile!
@PraveenMalethia Email is not received in the user
or the profile
object.
Looks like the email update API is already working on my side? @PraveenMalethia
However, the frontend changes reflect after refreshing the page.
I get that. The backend is updating the email but it's not sending the updated email back in the response. Because of that we are not able to update the email with new email in front-end.
I get that. The backend is updating the email but it's not sending the updated email back in the response. Because of that we are not able to update the email with new email in front-end.
Okay, i get that @mani-barathi .
A temporary solution would be to monitor success (in .then) where the API call is being made from and set the email to the entered email. Or set to the previous email in case of API call failure (in .catch) if backend will delay.
@MidouWebDev should I implement the temporary fix suggested by @okumujustine
@MidouWebDev should I implement the temporary fix suggested by @okumujustine
That will be great, @Mr-spShuvo you could assign @mani-barathi on this if it's okay.
Backend is updated to return updated email in response. Now you can update the frontend!
@mani-barathi , you are working on this !?
@okumujustine I did make a simple temporary change, but if you what to take this issue go ahead and do it. Here is the link to PR I made. Mr-spShuvo was requesting some changes so have a look into that.
Preflight Checklist
#
Describe the bug
I can't update my email address in the profile settings
#
To Reproduce
Steps to reproduce the behavior:
#
Expected behavior
I expected to be able to update my email address like for the avatar
#
Screenshots