[英]handleResetPassword in custom email action handlers
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.
});
}
Using above handleResetPassword
function I can get the email with auth.verifyPasswordResetCode
and how to continue to auth.confirmPasswordReset
with new password? 使用上面的
handleResetPassword
函数,我可以使用auth.verifyPasswordResetCode
获取电子邮件,以及如何继续使用新密码进行auth.confirmPasswordReset
? Do I need html form? 我需要HTML表单吗? then what will be the action of that form?
那么该表格的作用是什么? I'm confusing to continue to
auth.confirmPasswordReset
. 我困惑继续
auth.confirmPasswordReset
。
You need a form with an input and a button but you never need to submit the form. 您需要一个带有输入和按钮的表单,但是您无需提交表单。 You ask the user to enter the new password in an input field.
您要求用户在输入字段中输入新密码。 On button click, you get the new password and call
confirmPasswordReset
with the actionCode
and new password while cancelling the submit action. 单击按钮后,您将获得新密码,并在取消提交操作的同时使用
actionCode
和新密码调用confirmPasswordReset
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.