hello, it seems like we can have multiples account with the same name (created in the auth dashboard). Is there an option or way to make them unique ? like throw a error when calling account.updateName() with a name already existing in the users.
thanks !
I believe you would have to implement this check yourself, maybe in a function, you have logic that pulls users where name == name, and if that returns atleast 1 item fail the process?
You'll either have to maintain a user metadata collection to do this logic client side, if you want to do it server side you'll have to use the server sdk to access the users endpoints.
Thanks for the answer. That's pretty annoying, i'm using the Account client api, and so anyone can manually do a updateName and circonvent any added client side check for username duplications
i thought unique username would be the default behaviour
the user id is the unique value
but it can't be changed after creation i think ?
right
the only secure way of doing this i see, where the user can't temper with it is to do a function with a event on update name, and if it already exists reset it to the previous one or a default/random.
i'll submit a idea to the appwrite devs to just add a option field for a unique index on names
it seems like a useful feature, for a lot of social sites (comments, posts, etc)
Sure, but don't most if not all social medias allow for vanity names :P Wouldn't the name attribute of the user be the vanity name, and the id be their @?
Like discord, my username is not Kenny, that's my vanity name
oh, yeah forgot about preferences
but it doesn't solve the uniqueness constraint ?
it still need a server function to check if the new name in the attributes is unique
Sure, I can see where you're coming from. You can create a feature request if you want, but in the interum you'd had to implement this functionality yourself.
i'll just display the users as name:id for now
[SOLVED: not possible] duplicate user names
Recommended threads
- Function connected custom domain error: ...
My domain is served through Cloudflare. Domain is now connected with the appwrite function. But when accessing the domain, I get the below error. Any suggestion...
- Error | general_unknown
I have built a website using Appwrite Cloud as backend, and also using sites for deployment. My website is live but sometimes it shows Appwrite's Error general_...
- Introducing new string column types made...
Adding new string types is hugely bennificial! Unfortunately it made the current column types not editable to change their types to the new longer field types.