Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async resendSignUp() {
const { username } = this.state
await Auth.resendSignUp(username)
.then(() => console.log('Confirmation code resent successfully'))
.catch(err => {
if (! err.message) {
console.log('Error requesting new confirmation code: ', err)
Alert.alert('Error requesting new confirmation code: ', err)
} else {
console.log('Error requesting new confirmation code: ', err.message)
Alert.alert('Error requesting new confirmation code: ', err.message)
}
})
}
render() {
handleResendRequest = () => {
console.log('RESENDING CODE');
Auth.resendSignUp(this.props.data.email)
.then(data => console.log(data))
.catch(err => console.log(err));
};
resend() {
const username = this.usernameFromAuthData() || this.inputs.username;
if (!Auth || typeof Auth.resendSignUp !== 'function') {
throw new Error('No Auth module found, please ensure @aws-amplify/auth is imported');
}
Auth.resendSignUp(username)
.then(() => logger.debug('code resent'))
.catch(err => this.error(err));
}
return (dispatch, getState) => {
const attemptedLoginEmail = (getState().auth as IAuthState).attemptedLoginEmail;
dispatch(loadingStart());
Auth.resendSignUp(attemptedLoginEmail)
.then(() => {
dispatch(setMessage("Verification link sent. Please check your email or spam folder for the verification link."));
dispatch(onAuthError(""));
}).catch(e => dispatch(onAuthError("Error sending confirmation email link: " + e)))
.then(() => dispatch(loadingEnd()));
}
}