adigutner
09/18/2022, 12:35 PMrp_st
09/18/2022, 1:09 PMrp_st
09/18/2022, 1:11 PMrp_st
09/18/2022, 1:11 PMts
ThirdPartyPasswordless.init({
contactMethod: "EMAIL_OR_PHONE",
validateEmailAddress: async function (value) {
if (typeof value !== "string") {
return "GENERAL_ERROR_EMAIL_OR_PHONE_NON_STRING";
}
value = value.trim();
const defaultEmailValidatorRegexp =
// eslint-disable-next-line no-useless-escape
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
// We check if the email syntax is correct
// As per https://github.com/supertokens/supertokens-auth-react/issues/5#issuecomment-709512438
// Regex from https://stackoverflow.com/a/46181/3867175
if (value.match(defaultEmailValidatorRegexp) === null) {
return "GENERAL_ERROR_EMAIL_OR_PHONE_INVALID";
}
return undefined;
}
})
rp_st
09/18/2022, 1:13 PMrp_st
09/18/2022, 3:12 PMrp_st
09/18/2022, 3:12 PMnpm i git+https://github.com:supertokens/supertokens-auth-react.git#0.25
rp_st
09/18/2022, 3:13 PMadigutner
09/18/2022, 3:41 PMrp_st
09/18/2022, 5:21 PMrp_st
09/18/2022, 5:21 PM