国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

WebSecurity ResetPassword 方法

2018-09-05 06:04 更新

WebSecurity - ResetPassword()


WebSecurity 對(duì)象 WebSecurity 對(duì)象

定義

ResetPassword() 方法使用密碼令牌重置用戶(hù)密碼。


C# 和 VB 語(yǔ)法

WebSecurity.ResetPassword(passwordResetToken,newPassword)


參數(shù)

參數(shù) 類(lèi)型 描述
passwordResetToken String 密碼令牌
newpassword String 新密碼


返回值

類(lèi)型 描述
Boolean 如果密碼已更改,則返回 true,否則返回 false。


錯(cuò)誤和異常

在下面的情況下,任何對(duì) WebSecurity 對(duì)象的訪問(wèn)將拋出一個(gè) InvalidOperationException

  • InitializeDatabaseConnection() 方法沒(méi)有被調(diào)用
  • SimpleMembership 沒(méi)有初始化(或者在網(wǎng)站配置中禁用)

備注

如果用戶(hù)已忘記密碼,請(qǐng)使用 ResetPassword 方法。

ResetPassword 方法要求一個(gè)密碼重置令牌。

確認(rèn)令牌可通過(guò) CreateAccount()CreateUserAndAccount()GeneratePasswordResetToken() 方法創(chuàng)建。

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

@{
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>


技術(shù)數(shù)據(jù)

名稱(chēng)
Namespace WebMatrix.WebData
Assembly WebMatrix.WebData.dll


WebSecurity 對(duì)象 WebSecurity 對(duì)象
以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)