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
。
答案 0 :(得分:0)
您需要一个带有输入和按钮的表单,但是您无需提交表单。您要求用户在输入字段中输入新密码。单击按钮后,您将获得新密码,并使用confirmPasswordReset
和新密码调用actionCode
,同时取消提交操作。