Rank 2: Process
Hello, how can I check if the Email or the username already exists and give seperate error messages?
Votes
1
Replies
14
Participants
Unknown
Messages
15
Rank 2: Process
Hello, how can I check if the Email or the username already exists and give seperate error messages?
Rank 2: Process
sorry i mean name not username
Name is not unique and two users can have the same name
Rank 2: Process
my problem is just that if i do a try catch it just says that one of them already exists but i dont know which of them
That's good
Rank 2: Process
but i want it to be unique (app side)
Rank 2: Process
try { await account().create( userId: ID.unique(), email: email, password: password, name: _usernameController.text, ); } catch (error) { final appwriteError = error as AppwriteException;
throw Exception(appwriteError.message); }```What you mean one of them, you're creating many in a loop?
Rank 2: Process
theres an input for email and for username (name)
if the name already exists it says this:
Error: Exception: A user with the same id, email, or phone already exists in this project.
if the email already exists it says this:
Error: Exception: A user with the same id, email, or phone already exists in this project.
For this, the best would be to create a function that will run (trigger) after each user change
You'll need to create another Collection with the current user name
So the flow can be like so
usernames collection.Rank 2: Process
ah
The name is not unique
So this error can mean only:
As you don't use the phone you can eliminate the one,
For ID to exist is pretty rare, so it means the email exist
Rank 2: Process
I probably try it tomorrow, so i'l probably ask something then
but thanks for your support
:appwritefire: