Reputation: 724
My app currently lets the user register his/her name, email, username, and password into the Firebase database. It creates a child: Users, which is then split into unique id's containing all the information for each id. Ex: Users -> [uniqueID] -> name, email....
I need help finding a way so that when the user enters their email and logs in, it will try to match it with any of the emails in the user's section of the database to see if it is valid. so like
if (listOfEmails.contains(emailLogin.getText().toString()) {
}
Upvotes: 0
Views: 81
Reputation: 139029
The easiest way to solve this is to use Firebase Authentication.
Than to verify if a user exists, create a new node in your Firebase database named usersEmail
. Every time a user wants to sign-in, add his/her email address there. Your database should look like this:
Firebase-root
|
---- usersEmail
|
---- userId1: "[email protected]"
|
---- userId2: "[email protected]"
|
---- userId3: "[email protected]"
|
//and so on
Hope it helps.
Upvotes: 1