繁体   English   中英

Firebase 验证和重置密码,无需发送单独的邮件

[英]Firebase verify and reset password without sending separate mails

作为离线用户创建的一部分,我想从我的后端服务器创建一个帐户并向用户发送验证邮件。 但是当用户点击验证链接时,我还想显示一个屏幕来设置他的密码。

在现有的网络应用程序中,我有单独的流程来处理验证和重置密码。 但它们是独立的流程。

从以下文档中,我可以看到有一个名为 mode 的参数来标识操作。 使用它,我们目前正在处理验证和重置密码操作。

但是有没有办法有一个自定义模式或一些方法来识别用户在验证后必须被带到不同的屏幕。

我能想到的一种解决方法是使用 continueUrl (可能使用自定义方案)。 不确定这是否会完美运行。

有人可以分享他们对此的想法。

使用continueUrl确实是正确的方法。 根据mode ,您可以决定要处理的操作,然后您可以在用户执行相应操作后重定向到continueUrl

例如,您参考的文档显示了以下示例(注意// TODO: If a continue URL is available...注释):

function handleVerifyEmail(auth, actionCode, continueUrl, lang) {
  // Localize the UI to the selected language as determined by the lang
  // parameter.
  // Try to apply the email verification code.
  auth.applyActionCode(actionCode).then(function(resp) {
    // Email address has been verified.

    // TODO: Display a confirmation message to the user.
    // You could also provide the user with a link back to the app.

    // 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) {
    // Code is invalid or expired. Ask the user to verify their email address
    // again.
  });
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM