How to use the @aws-amplify/auth.forgotPasswordSubmit function in @aws-amplify/auth

To help you get started, we’ve selected a few @aws-amplify/auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yhenni1989 / ReactNativeAuth / src / components / screens / ForgetPasswordScreen.js View on Github external
async forgotPasswordSubmit() {
    const { username, authCode, newPassword } = this.state
    await Auth.forgotPasswordSubmit(username, authCode, newPassword)
    .then(() => {
      this.props.navigation.navigate('SignIn')
      console.log('the New password submitted successfully')
    })
    .catch(err => {
      if (! err.message) {
        console.log('Error while confirming the new password: ', err)
        Alert.alert('Error while confirming the new password: ', err)
      } else {
        console.log('Error while confirming the new password: ', err.message)
        Alert.alert('Error while confirming the new password: ', err.message)
      }
    })
  }
  render() {
github TreeHacks / root / src / store / auth / actions.ts View on Github external
return dispatch => {
    if (data.password !== data.password2) {
      dispatch(onAuthError("Passwords do not match."));
      return;
    }
    dispatch(loadingStart());
    Auth.forgotPasswordSubmit(data.email.toLowerCase(), data.code, data.password)
      .then(() => dispatch(setAuthPage("signIn", "Password changed successfully! Please log in with your new password:")))
      .catch(e => dispatch(onAuthError(e.message)))
      .then(() => dispatch(loadingEnd()))
  }
}
github aws-amplify / amplify-js / packages / aws-amplify-react / src / Auth / ForgotPassword.tsx View on Github external
submit() {
		const { authData = {} } = this.props;
		const { code, password } = this.inputs;
		const username = this.getUsernameFromInput() || authData.username;

		if (!Auth || typeof Auth.forgotPasswordSubmit !== 'function') {
			throw new Error(
				'No Auth module found, please ensure @aws-amplify/auth is imported'
			);
		}
		Auth.forgotPasswordSubmit(username, code, password)
			.then(data => {
				logger.debug(data);
				this.changeState('signIn');
				this.setState({ delivery: null });
			})
			.catch(err => this.error(err));
	}