Back

Unique User Names

  • 0
  • Flutter
  • Databases
  • Accounts
  • Cloud
  • Users
Hassanmrwt
9 Jun, 2023, 07:47

How can we manage to give unique names to user so that no other user can get the same or earlier taken name.

TL;DR
The user wants to assign unique usernames to users. One suggestion is to use a separate attribute for the username. Another suggestion is to create a document with the custom name as the ID. If a user wants to change their username, they can edit the document's ID. Adding support for editing document IDs is another suggestion. One solution is to query if a custom name already exists before assigning it to a user. The user wants to allow users to create custom names for custom URLs. To ensure uniqueness, one suggestion is to create random strings or use unique IDs. Ultimately, the user wants to find a way to give each user a unique name
animeyeet
9 Jun, 2023, 07:48

either just create random strings or ID.unique()

Hassanmrwt
9 Jun, 2023, 07:48
Hassanmrwt
9 Jun, 2023, 07:49

No I want to go with user's provided names

animeyeet
9 Jun, 2023, 07:50

technical when a user is created it already assigns unique id

animeyeet
9 Jun, 2023, 07:51

so even if the names are same it's dosen't matter

Hassanmrwt
9 Jun, 2023, 07:52

I wanted to let user create custom names so that they can get custom URL to accounts

animeyeet
9 Jun, 2023, 07:54

map this to collection then and check every time before assigning the user name that if this already exist

animeyeet
9 Jun, 2023, 07:56

like a create a custom name -> create a document with name and who created it(user)

animeyeet
9 Jun, 2023, 07:57

then if query everytime a user is creating a custom name check if it's already exists or not

Hassanmrwt
9 Jun, 2023, 08:01

This could be a solution but if Appwrite gives us access to Edit Document's or User's ID then will be simple for us.

animeyeet
9 Jun, 2023, 08:02

if the is property like unique in attribute that would be more easy

animeyeet
9 Jun, 2023, 08:03

like in sql

Hassanmrwt
9 Jun, 2023, 08:03

@Steven I think we should add support for editing document's ID's this way we can handle unique user's names

animeyeet
9 Jun, 2023, 08:04

you don't have to editing document's ID just create the document with custom name

animeyeet
9 Jun, 2023, 08:05
animeyeet
9 Jun, 2023, 08:06
animeyeet
9 Jun, 2023, 08:06

document id as custom name so that no other user can create same document

animeyeet
9 Jun, 2023, 08:07

@Hassanmrwt i think this does meet your requirement

Hassanmrwt
9 Jun, 2023, 08:12

Yes this also does but I want user to edit their custom names any time or after specific time.

Hassanmrwt
9 Jun, 2023, 08:13

With this we can control things in registration time but later when user want to change his user name then?

animeyeet
9 Jun, 2023, 08:19

store(in response)/get the prev document -> delete that document -> create a new one with new name as docId (check if exist or not) and whatever with previous data that was present in at that time with that prev response

animeyeet
9 Jun, 2023, 08:20

``

Drake
9 Jun, 2023, 14:05

this opens a big can of worms. For example, they would lose access to things because the permission on some document was read("user:old_id")

Drake
9 Jun, 2023, 14:06

for your case, you might want to use a separate attribute for username

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more