VGSecurityManagerValidatingPassword Event
|
Occurs when a password is changed or is reset.
Namespace:
Novalys.VisualGuard.Security
Assembly:
Novalys.VisualGuard.Security (in Novalys.VisualGuard.Security.dll) Version: 2019.1.831.19 (2019.1.0831.19)
Syntax Remarks
The event handler receives an argument of type
VGValidatePasswordEventArgs containing data related to this event.
The
ValidatingPassword event allows to cancel the password modification when the password is not valid.
Examples
This example show a
ValidatingPassword event that checks whether the password does not contain a list of invalid string.
private void OnValidatingPassword (object sender, VGValidatePasswordEventArgs args)
{
string[] invalidText = new string[] { "pwd", "password", "passwd", "aaa", "bbb" };
foreach (string text in invalidText)
{
if (e.Password.IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0
{
e.Cancel = true;
return;
}
}
if (e.Password.IndexOf(e.UserName, StringComparison.CurrentCultureIgnoreCase) >= 0)
{
e.Cancel = true;
}
}
Private Sub OnValidatingPassword(ByVal sender As Object, ByVal e As VGValidatePasswordEventArgs)
Dim invalidText() As String = New String() {"password", "novalys", "aaa", "bbb", "ccc"}
For Each text As String In invalidText
If e.Password.IndexOf(text, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
e.Cancel = True
Return
End If
Next
If e.Password.IndexOf(e.UserName, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
e.Cancel = True
End If
End Sub
See Also