Skip to content

Update users Email in Parse #51

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

Closed
arasu01 opened this issue Aug 19, 2015 · 8 comments
Closed

Update users Email in Parse #51

arasu01 opened this issue Aug 19, 2015 · 8 comments
Labels
type:question Support or code-level question

Comments

@arasu01
Copy link

arasu01 commented Aug 19, 2015

I have PFUser object and it has firstName, lastName and Email.

When I try to update the user's email which is already exist, i am receiving error. But when fetch the email from [PFUser currentUser], it returns wrong email, how to overcome this. Below is the my code for it.

PFUser *user = [PFUser currentUser];
user[@"email"] = @"[email protected]"
[user saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
//UI refresh
}];
I received the following error : the email address [email protected] has already been taken (Code: 203, Version: 1.7.4)

After this when fetching the email for current user

PFUser *user = [PFUser currentUser];
NSString *email = user[@"email"];
NSLog("email %@", email);
I received the following email "[email protected]" but which is wrong, which should be "[email protected]".

FYI : I am also using parse offline store
This is posted in stack overflow in the below link : http://stackoverflow.com/questions/32064941/update-users-email-in-parse?answertab=active#tab-top

The same issue has been reported in the Parse Developers google forums : https://groups.google.com/forum/#!searchin/parse-developers/update$20email$20ios/parse-developers/CyH2wiywE7s/09KPXeXn7JwJ

Waiting for a quick fix or workaround from Parse

@nlutsenko nlutsenko added the type:question Support or code-level question label Aug 19, 2015
@nlutsenko nlutsenko self-assigned this Aug 19, 2015
@nlutsenko
Copy link
Contributor

@arasu01 The error that you are seeing definetly comes from server.
The email field should be unique across the entire column, so if you already have a user with that email - you can't create or change another one to have the same one.

Hope it helps, if not - please reopen this issue or simply comment here.

@arasu01
Copy link
Author

arasu01 commented Aug 19, 2015

I was already aware that the error is coming from parse server.
In current user i have the email as "[email protected]" and i was updating it the email to "[email protected]". And it gives the error from the parse server.

My issue arise from the current user where it should have the email as "[email protected]", but whenever i fetch it is returning the "[email protected]", I think this is problem due to parse offline data store.

Here i have logout the current user and i have to log in again to get the correct email address.

This works fine when update the with the different address which didn't exists in Parse. Also when i am not using parse offline store.

@nlutsenko
Copy link
Contributor

Thanks for clarifying, now it's clear.
The email field becomes dirty whenever you are changing it, and with Local Datastore - it will persist those changes locally, but indeed it will prevent from saving the user further, since that email already exists.

We don't have the revert functionality on a PFObject yet, but it's definitely on our list for things to be implemented. Let me create a separate issue for that one so we can mark it accordingly.

@nlutsenko
Copy link
Contributor

@arasu01 Just created #52 for tracking this, feel free to comment there.

@arasu01
Copy link
Author

arasu01 commented Aug 19, 2015

@nlutsenko: Thanks for quick turn around.

@magneticrob
Copy link

I also came across this issue today. A PFUser had been updated with an email that belonged to another user, and couldn't save (obviously). After this point, calling fetchIfNeeded (even after unpinning) returned a dirty object. Also, logging the user out and logging them back in again returned a dirty object.

It seems the only way to get around this issue is to delete the app and reinstall it, which really isn't ideal - could I have gone about this any other way?

@magneticrob
Copy link

Nevermind, I've updated Parse since and discovered revert! I now check if the user is dirty on login, if they are, I revert and run the login flow again.

@uzaysan
Copy link

uzaysan commented May 6, 2019

same thing happens with username too
parse-community/parse-server#5564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

4 participants