Resets a user's password to a new, automatically generated password.
Namespace: Novalys.VisualGuard.SecurityAssembly: Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2017.0.101.17 (2017.0.101.17)
Syntax
C# |
---|
[ObsoleteAttribute("You need to use ResetPassword method in {VGSecurityRuntime.Membership}")] public string ResetPassword( string name, string passwordAnswer ) |
Visual Basic |
---|
<ObsoleteAttribute("You need to use ResetPassword method in {VGSecurityRuntime.Membership}")> Public Function ResetPassword ( name As String, passwordAnswer As String ) As String |
Parameters
- name
- Type: System..::..String
The name of the user to reset the password for.
- passwordAnswer
- Type: System..::..String
The password answer for the specified user.
Return Value
Type: StringThe new password for the specified user.
Remarks
The password answer check is case sensitive. We strongly recommend to store the password answer as a lowered string and provide a lowered value of the password answer when you want to reset the password by using the password question and answer.
C# | Copy |
---|---|
user.ChangePasswordQuestionAndAnswer(myPassword.Text, newPasswordQuestion.Text, newPasswordAnswer.Text.ToLowerInvariant()) |
C# | Copy |
---|---|
user.ResetPassword(myPasswordAnswer.Text.ToLowerInvariant()) |
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | The name is null. orThe passwordAnswer is null and RequiresQuestionAndAnswer is set to true. |
System..::..ArgumentException | The name or passwordAnswer is longer than 64 characters orThe name is empty. |
Novalys.VisualGuard.Security.Membership..::..VGMembershipPasswordException | passwordAnswer is invalid.
- or - The user account is currently locked out or does not exist.- or - The generated password does not pass the password policy validation. |
System..::..NotSupportedException | EnablePasswordReset is not set to true. - Or -the repository does not support Visual Guard authentication mode. |