How to use the aws-amplify.Auth.forgotPassword function in aws-amplify

To help you get started, we’ve selected a few aws-amplify 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 dabit3 / full-stack-serverless-code / custom-authentication / src / Form.js View on Github external
async function forgotPassword({ username }, updateFormType) {
  try {
    await Auth.forgotPassword(username)
    updateFormType('forgotPasswordSubmit')
  } catch (err) {
    console.log('error submitting username to reset password...', err)
  }
}
github pjay79 / BarsAppAmplify / app / features / Auth / ForgotPasswordScreen.js View on Github external
resetPassword = async () => {
    try {
      this.setState({ loading: true, error: '' });
      const { username } = this.state;
      if (username) {
        const password = await Auth.forgotPassword(username);
        this.setState({ loading: false, status: 'Reset confirmation pending...' });
        console.log(password);
      } else {
        this.setState({ loading: false, error: 'Complete missing fields.' });
      }
    } catch (error) {
      this.setState({ loading: false, error: error.message });
      console.log(error.message);
    }
  };
github odyssy-automaton / pocket-moloch / src / views / auth / ForgotPassword.js View on Github external
onSubmit={async (values, { setSubmitting }) => {
          try {
            Auth.forgotPassword(values.username).then(() => {
                history.push('/forgot-password-confirm');
              });

            setSubmitting(false);

          } catch (err) {
            console.log('error forgetting pass: ', err);
            authError = err;
            setSubmitting(false);
          }
        }}
      >
github jspsych / jsPsych-Redux-GUI / src / common / backend / auth / index.js View on Github external
export const forgotPassword = ({username}) => {
	return Auth.forgotPassword(username).then(data => data);
}
github mzohaibqc / antd-amplify-react / src / ResetPasswordForm.js View on Github external
send() {
    const { username } = this.inputs;
    Auth.forgotPassword(username)
      .then(data => {
        this.setState({ loading: false });
        logger.debug(data);
        this.setState({ delivery: data.CodeDeliveryDetails });
      })
      .catch(err => {
        this.setState({ loading: false });
        message.error(err.message);
      });
  }
github aws-samples / aws-mobile-react-sample / client / src / Auth / Forget.jsx View on Github external
sendVerificationCode = async (e) => {
        e.preventDefault();
        const username = this.state.username;
        if (!username) {
            this.setState(() => {
                return {
                    invalidCodeOrPasswordMessage: 'Please input valid username'
                }
            })
        }
        Auth.forgotPassword(username)
            .then(data => {
                if (this.state.enableSend) {
                    this.setState(() => {
                        return {
                            enableSend: false
                        }
                    });
                    this.countDownResendVerificationCode();
                }
                if (this.state.enableResend) {
                    this.setState(() => {
                        return {
                            enableResend: false
                        }
                    })
                    this.countDownResendVerificationCode();
github aws-amplify / amplify-js / packages / aws-amplify-react-native / dist / Auth / ForgotPassword.js View on Github external
send() {
        const { username } = this.state;
        if (!username) {
            this.error('Username cannot be empty');
            return;
        }
        Auth.forgotPassword(username).then(data => {
            logger.debug(data);
            this.setState({ delivery: data.CodeDeliveryDetails });
        }).catch(err => this.error(err));
    }
github aws-amplify / amplify-js / packages / aws-amplify-react-native / src / Auth / ForgotPassword.js View on Github external
send() {
		const username = this.getUsernameFromInput();
		if (!username) {
			this.error('Username cannot be empty');
			return;
		}
		Auth.forgotPassword(username)
			.then(data => {
				logger.debug(data);
				this.setState({ delivery: data.CodeDeliveryDetails });
			})
			.catch(err => this.error(err));
	}
github richardzcode / Journal-AWS-Amplify-Tutorial / step-08 / journal / src / components / ForgotPasswordForm.js View on Github external
send() {
        const { username } = this.inputs;
        Auth.forgotPassword(username)
            .then(data => {
                logger.debug(data)
                this.setState({ delivery: data.CodeDeliveryDetails });
            })
            .catch(err => this.error(err));
    }