簡體   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