成免费的crm,久久国产精品新农夫导航新妓网,恋夜秀场全部视频安卓手机,女校花强奷在线播放A级

WebSecurity GeneratePasswordResetToken 方法

websecurity - generatepasswordresettoken()

websecurity 對象 websecurity 對象

定義

generatepasswordresettoken() 方法生成一個密碼重置令牌,可以在電子郵件中發送給用戶以便用戶可以重設密碼。

c# 和 vb 語法

websecurity.generatepasswordresettoken(username, expiration)

參數

參數 類型 描述
username string 用戶名
expiration integer 令牌到期時間,以分鐘計。默認是 1440(24 小時)

返回值

類型 描述
string 一個重置令牌。

錯誤和異常

在下面的情況下,任何對 websecurity 對象的訪問將拋出一個 invalidoperationexception:

  • initializedatabaseconnection() 方法沒有被調用
  • simplemembership 沒有初始化(或者在網站配置中禁用)

備注

如果用戶已忘記密碼,請使用 resetpassword() 方法。resetpassword() 方法要求一個密碼重置令牌。

確認令牌可通過 createaccount()、 createuserandaccount() 或 generatepasswordresettoken() 方法創建。

密碼可通過代碼重置,但是一般過程是發送電子郵件給用戶(帶有令牌和指向頁面的鏈接),這樣用戶就可以通過新的令牌確認新的密碼:

@{
newpassword = request["newpassword"];
confirmpassword = request["confirmpassword"];
token = request["token"];
if ispost
{
??? // input testing is ommitted here to save space
??? retunvalue = resetpassword(token, newpassword);
}
}
<h1>change password</h1>

<form method="post" action="">

<label for="newpassword">new password:</label>
<input type="password" id="newpassword" name="newpassword" title="new password" />

<label for="confirmpassword">confirm password:</label>
<input type="password" id="confirmpassword" name="confirmpassword" title="confirm new password" />

<label for="token">pasword token:</label>
<input type="text" id="token" name="token" title="password token" />

<p class="form-actions">
<input type="submit" value="change password" title="change password" />
</p>

</form>

技術數據

名稱
namespace webmatrix.webdata
assembly webmatrix.webdata.dll

websecurity 對象 websecurity 對象
相關文章