2
0
mirror of synced 2025-01-11 14:44:12 +00:00

[js][auth] add signInWithEmailLink method + tweak isSignInWithEmailLink

This commit is contained in:
Salakar 2018-05-13 00:09:00 +01:00
parent 3cba1c4e62
commit 59b406e8ed

View File

@ -413,11 +413,28 @@ export default class Auth extends ModuleBase {
isSignInWithEmailLink(emailLink: string): boolean {
return (
typeof emailLink === 'string' &&
emailLink.includes('mode=signIn') &&
emailLink.includes('oobCode=')
(emailLink.includes('mode=signIn') ||
emailLink.includes('mode%3DsignIn')) &&
(emailLink.includes('oobCode=') || emailLink.includes('oobCode%3D'))
);
}
/**
* Asynchronously signs in using an email and sign-in email link.
*
* @param {string} email The email account to sign in with.
* @param {string} emailLink Sign-in email link.
* @return {Promise} A promise resolved upon completion
*/
signInWithEmailLink(
email: string,
emailLink: string
): Promise<UserCredential> {
return getNativeModule(this)
.signInWithEmailLink(email, emailLink)
.then(userCredential => this._setUserCredential(userCredential));
}
/**
* Completes the password reset process, given a confirmation code and new password.
*