I am using Firebase authentication in my React Native application development. The problem I am facing is On implementing reset password functionality users receiving emails even though they are not a registered user in Firebase.
How can I send reset password emails only for Firebase registered users?
How can I achieve this from the frontend side(React Native)?
Here is the code I am using.
import firebase from '@react-native-firebase/app';
export function onForgotPassword(email: string) {
firebase
.auth()
.sendPasswordResetEmail(email)
.then(() => {
// alert('Please check your email...');
})
.catch((e) => {
NLog.log(e);
});
}
Thanks in advance.
I'd probably agree with Anthony's comment and leave it to Firebase to sort this out.
If you really want to handle it in your code, you can use fetchSignInMethodsForEmail
to check if an email address is known for any provider before trying to send a reset message to it.