Javascript等待功能,直到用户输入提交为止

时间:2018-07-10 06:32:41

标签: javascript node.js firebase

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;
        actionCode = actionCode;

        // 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) {
          console.log(error);
          // Error occurred during confirmation. The code might have expired or the
          // password is too weak.
        });
      }).catch(function(error) {
        console.log(error);
        // Invalid or expired action code. Ask user to try to reset the password
        // again.
      });
    }

这是我与firebase自定义电子邮件处理程序有关的函数,最初执行auth.verifyPasswordResetCode。然后,我需要获取用户输入的文本,然后再转到auth.confirmPasswordReset并将其传递给auth.confirmPasswordReset。我该怎么做?

0 个答案:

没有答案