使用自定义域重置Firebase密码无效

时间:2019-01-04 12:28:38

标签: javascript firebase firebase-authentication firebase-hosting

我已经使用Firebase托管配置了自定义域,并已将其连接以进行密码重置。我相关的部署代码如下。

function handleResetPasswordSection(auth, actionCode, continueUrl, lang) {

  var accountEmail;

  auth.verifyPasswordResetCode(actionCode).then(function(email) {
    var accountEmail = email;
    actionCode = actionCode;

    var newPassword = document.getElementById("newPasswordInput").value;

    auth.confirmPasswordReset(actionCode, newPassword).then(function(resp) {
      console.log(resp);
      var messageDiv = document.getElementById("message");
      var successDiv = document.getElementById("success");

      messageDiv.style.display = "none";
      successDiv.style.display = "block";
      // Password reset has been confirmed and new password updated.


    }).catch(function(error) {
      console.log(error);
      var messageDiv = document.getElementById("message");

      messageDiv.style.display = "none";

      var errorDiv = document.getElementById("error");
      errorDiv.style.display = "block";
      $("#error > p").text(error.message);

    });
  }).catch(function(error) {
    console.log(error);
    var messageDiv = document.getElementById("message");

    messageDiv.style.display = "none";

    var errorDiv = document.getElementById("error");
    errorDiv.style.display = "block";
    $("#error > p").text(error.message);

  });
}

function handleResetPassword(auth, actionCode, continueUrl, lang) {
  auth.verifyPasswordResetCode(actionCode).then(function(email) {

  }).catch(function(error) {
    console.log(error);
    var messageDiv = document.getElementById("message");

    messageDiv.style.display = "none";

    var errorDiv = document.getElementById("error");
    errorDiv.style.display = "block";
    $("#error > p").text(error.message);

  });  
}

恢复成功发送的电子邮件,单击该链接后,它显示输入新密码,并突然显示错误The action code is invalid. This can happen if the code is malformed, expired, or has already been used.。为什么会这样?

0 个答案:

没有答案