handleResetPassword в пользовательских обработчиках действий электронной почты - PullRequest
0 голосов
/ 05 июля 2018
function handleResetPassword(auth, actionCode, continueUrl, lang) {
  // Localize the UI to the selected language as determined by the lang
  // parameter.
  var accountEmail;
  // Verify the password reset code is valid.
  auth.verifyPasswordResetCode(actionCode).then(function(email) {
    var accountEmail = email;

    // TODO: Show the reset screen with the user's email and ask the user for
    // the new password.

    // Save the new password.
    auth.confirmPasswordReset(actionCode, newPassword).then(function(resp) {
      // Password reset has been confirmed and new password updated.

      // TODO: Display a link back to the app, or sign-in the user directly
      // if the page belongs to the same domain as the app:
      // auth.signInWithEmailAndPassword(accountEmail, newPassword);

      // TODO: If a continue URL is available, display a button which on
      // click redirects the user back to the app via continueUrl with
      // additional state determined from that URL's parameters.
    }).catch(function(error) {
      // Error occurred during confirmation. The code might have expired or the
      // password is too weak.
    });
  }).catch(function(error) {
    // Invalid or expired action code. Ask user to try to reset the password
    // again.
  });
}

Используя вышеуказанную функцию handleResetPassword, я могу получить электронное письмо с auth.verifyPasswordResetCode и как перейти к auth.confirmPasswordReset с новым паролем? Нужна ли мне HTML-форма? тогда каковы будут действия этой формы? Я смущаюсь, чтобы продолжать auth.confirmPasswordReset.

1 Ответ

0 голосов
/ 09 июля 2018

Вам нужна форма с вводом и кнопкой, но вам никогда не нужно отправлять форму. Вы просите пользователя ввести новый пароль в поле ввода. При нажатии кнопки вы получаете новый пароль и звоните confirmPasswordReset с actionCode и новым паролем при отмене действия отправки.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...