My current firebase system allows me to signup with a new user using firebase createuser() taking an email and password, In the oncomplete method I also take the details used to sign up so the email and password along with some other variables I create such as username and DOB and save them to the firebase db with the following code:
// ...database code above
DatabaseReference users = database.getReference("users");
User user = new User(username, password,DOB,email);
users.push().setValue(user);
- I need to check now before saving to the database that the username is unique if it is not it asks for another username
- I have also implemented a system where when the user logs in, it checks the String if it is an email or a username, if the user logs in with an email then it'll use firebase's system to login but if they use a username then it has to check the firebase database to see if the username exists and then checks if the password is correct
I have no idea how to do any of the above, any help is much appreciated thanks. I have used the stackoverflow search and realise there are posts with this question that has already been asked, I have tried a few of these solutions that didn't work because everyones database structure is different
