WebSecurity - ResetPassword ()
❮ WebSecurity
အဓိပ္ပါယ်
ResetPassword () နည်းလမ်းသည် စကားဝှက်တိုကင်ကို အသုံးပြု၍ သုံးစွဲသူစကားဝှက်ကို ပြန်လည်သတ်မှတ်သည်။
C# နှင့် VB Syntax
WebSecurity.ResetPassword(passwordResetToken,newPassword)
ကန့်သတ်ချက်များ
Parameter | Type | Description |
---|---|---|
passwordResetToken | String | The password token |
newpassword | String | The new password |
တန်ဖိုးကို ပြန်ပေးသည်။
Type | Description |
---|---|
Boolean | true if the password was changed, otherwise false |
အမှားများနှင့် ခြွင်းချက်များ
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>
❮ WebSecurity