sanctified
Programmer
Hi Group,
I'm using the built-in sp_password SP and was wondering if I could get at the last 6 passwords the user has used and prevent them from using them again. I'm using ASP.NET as my front-end.
Here is a snippet of code:
Private Sub btnSaveChanges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click
Dim strMsg As String
strMsg = ""
'Check that the new password confirmation matches
If txtNew.Text <> txtConfirmNew.Text Then
strMsg = "The new passwords do not match"
End If
'Check to see if a password has been entered
If txtNew.Text = "" Then
strMsg = "The new password cannot be blank"
End If
'test width of text string
If Len(txtNew.Text) < 6 Then
strMsg = "The password must be at least 6 characters"
End If
'Return error string
If strMsg <> "" Then
Dim strScript As String = "<script language=Javascript>"
strScript += "alert(""" & strMsg & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
Exit Sub
End If
'Connect to the database
Dim strCmd As String
strCmd = "sp_password"
Try
connDBConnect.ConnectionString = Session("ConnectionString")
cmdDBCommand.Connection = connDBConnect
cmdDBCommand.CommandText = strCmd
cmdDBCommand.CommandType = CommandType.StoredProcedure
cmdDBCommand.Parameters.Add(New SqlParameter("@old", Data.SqlDbType.VarChar, 20))
cmdDBCommand.Parameters.Add(New SqlParameter("@new", Data.SqlDbType.VarChar, 20))
cmdDBCommand.Parameters("@old").Value = txtCurrent.Text
cmdDBCommand.Parameters("@new").Value = txtNew.Text
connDBConnect.Open()
cmdDBCommand.ExecuteNonQuery()
lblMessage.Text = "Password successfully changed"
.......
End sub
I'm using the built-in sp_password SP and was wondering if I could get at the last 6 passwords the user has used and prevent them from using them again. I'm using ASP.NET as my front-end.
Here is a snippet of code:
Private Sub btnSaveChanges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click
Dim strMsg As String
strMsg = ""
'Check that the new password confirmation matches
If txtNew.Text <> txtConfirmNew.Text Then
strMsg = "The new passwords do not match"
End If
'Check to see if a password has been entered
If txtNew.Text = "" Then
strMsg = "The new password cannot be blank"
End If
'test width of text string
If Len(txtNew.Text) < 6 Then
strMsg = "The password must be at least 6 characters"
End If
'Return error string
If strMsg <> "" Then
Dim strScript As String = "<script language=Javascript>"
strScript += "alert(""" & strMsg & """);"
strScript += "</script>"
If (Not Page.IsStartupScriptRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", strScript)
End If
Exit Sub
End If
'Connect to the database
Dim strCmd As String
strCmd = "sp_password"
Try
connDBConnect.ConnectionString = Session("ConnectionString")
cmdDBCommand.Connection = connDBConnect
cmdDBCommand.CommandText = strCmd
cmdDBCommand.CommandType = CommandType.StoredProcedure
cmdDBCommand.Parameters.Add(New SqlParameter("@old", Data.SqlDbType.VarChar, 20))
cmdDBCommand.Parameters.Add(New SqlParameter("@new", Data.SqlDbType.VarChar, 20))
cmdDBCommand.Parameters("@old").Value = txtCurrent.Text
cmdDBCommand.Parameters("@new").Value = txtNew.Text
connDBConnect.Open()
cmdDBCommand.ExecuteNonQuery()
lblMessage.Text = "Password successfully changed"
.......
End sub