Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Sub UpdateNewPwd(ByVal NewPwd As String)
Dim cnn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnString"))
Dim cmd As SqlCommand = cnn.CreateCommand
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "WCUpdatePWD"
cnn.Open()
Try
cmd.Parameters.Add(New SqlParameter("@NewPwd", NewPwd))
cmd.Parameters.Add(New SqlParameter("@UserID", Session("Userid")))
cmd.ExecuteNonQuery()
lblError.Text = "You password has been changed."
Catch eSQL As SqlException
Dim objError As SqlError
For Each objError In eSQL.Errors
lblError.Text = "A Database error has occured.<br> " & objError.Message & " <br> Your data has not been updated."
Next
Exit Sub
Finally
cnn.Close()
End Try
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim strNewEncryption As String
Dim EAPI As User 'Call EAPI
EAPI = New User()
Try
If txtNewPassword.Text.Trim <> txtNewPasswordConfirm.Text.Trim Then
lblError.Text = "Your 'New Password' and 'Confirm New Password' do NOT match! Please try again."
Else
ESPAPI.EncryptPassword(Session("userid"), txtNewPassword.Text.Trim, strNewEncryption)
UpdateNewPwd(strNewEncryption)
End If
Catch ex As Exception
lblError.Text = ex.Message.ToString
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
txtPassword.Text = String.Empty
txtNewPassword.Text = String.Empty
txtNewPasswordConfirm.Text = String.Empty
End Sub
End Class