419 lines
23 KiB
VB.net
419 lines
23 KiB
VB.net
|
|
Imports System.Data.SqlClient
|
|
|
|
Partial Class login_Change_PW
|
|
Inherits System.Web.UI.Page
|
|
|
|
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
Dim url = Request.ServerVariables("URL")
|
|
Session.Add("urltochangepw", url)
|
|
Dim ConnectionString = ""
|
|
|
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
|
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
|
End If
|
|
|
|
Using con As New SqlConnection(ConnectionString)
|
|
' Using cmd As New SqlCommand("Validate_User")
|
|
Using cmd As New SqlCommand("SELECT UserId,Username,KundenNr FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND UserId=@UserId")
|
|
' cmd.CommandType = CommandType.StoredProcedure
|
|
Dim usrname As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2"))
|
|
Dim KundenNr As String = VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt(Request.QueryString("Par3"))
|
|
Dim UsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography3.Decrypt(Request.QueryString("Par4"))
|
|
cmd.Parameters.AddWithValue("@Username", usrname)
|
|
cmd.Parameters.AddWithValue("@UserId", UsrID)
|
|
cmd.Connection = con
|
|
con.Open()
|
|
' userId = Convert.ToInt32(cmd.ExecuteScalar())
|
|
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
|
If dr.HasRows Then
|
|
dr.Read()
|
|
|
|
If getDateoftoken(Request.QueryString("Par1")) = True AndAlso usrname = dr("Username") AndAlso KundenNr = dr("KundenNr") AndAlso UsrID = dr("UserId") Then
|
|
Try
|
|
If IsPostBack Then
|
|
If String.IsNullOrEmpty(txt_Pw.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw_WH.Text) = False Then
|
|
txt_Pw_WH.Enabled = False
|
|
reqPassw1txt_M.Enabled = False
|
|
reqPasswtxt_M.Enabled = False
|
|
reqPasswtxt.Enabled = True
|
|
reqPassw1txt.Enabled = True
|
|
reqPasswtxt.Validate()
|
|
If reqPasswtxt.IsValid = True Then
|
|
txt_Pw_WH.Enabled = True
|
|
reqPassw1txt.Validate()
|
|
End If
|
|
ElseIf String.IsNullOrEmpty(txt_Pw_M.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw_WH_M.Text) = False Then
|
|
txt_Pw_WH_M.Enabled = False
|
|
reqPasswtxt.Enabled = False
|
|
reqPassw1txt.Enabled = False
|
|
reqPassw1txt_M.Enabled = True
|
|
reqPasswtxt_M.Enabled = True
|
|
reqPasswtxt_M.Validate()
|
|
If reqPasswtxt_M.IsValid = True Then
|
|
txt_Pw_WH_M.Enabled = True
|
|
reqPassw1txt_M.Validate()
|
|
End If
|
|
End If
|
|
End If
|
|
Catch exc As Exception
|
|
lbl_messagetext.Text = exc.Message
|
|
End Try
|
|
Else
|
|
VERAG_VARIABLES.initerrorcount()
|
|
VERAG_VARIABLES.seterrorcount(1)
|
|
lbl_messagetext.Text = VERAG_VARIABLES.geterrornumb + "Link ist abgelaufen. Bitte neue E-Mail senden."
|
|
'Response.Redirect("ForgotPW.aspx")
|
|
End If
|
|
dr.Close()
|
|
End If
|
|
End Using
|
|
con.Close()
|
|
End Using
|
|
End Sub
|
|
|
|
Function getDateoftoken(tokenname As String) As Boolean
|
|
Dim data() As Byte = Convert.FromBase64String(VERAG_PROG_ALLGEMEIN.cCryptography3.Decrypt(tokenname))
|
|
Dim wenn As DateTime = DateTime.FromBinary(BitConverter.ToInt64(data, 0))
|
|
Dim nameoftoken = VERAG_PROG_ALLGEMEIN.cCryptography3.Decrypt(tokenname)
|
|
If wenn < DateTime.UtcNow.AddMinutes(-30) Then
|
|
nameoftoken = String.Empty
|
|
tokenname = nameoftoken
|
|
'MsgBox("Token has not been found or is too old!" + Environment.NewLine + "Please send a new E-mail!")
|
|
lbl_messagetext.Text = "Token has not been found or is too old!" + Environment.NewLine + "Please send a new E-mail!"
|
|
|
|
Session.Remove("TokenforEmail")
|
|
Return True
|
|
ElseIf nameoftoken = "Error04" Then
|
|
nameoftoken = String.Empty
|
|
tokenname = nameoftoken
|
|
Session.Remove("TokenforEmail")
|
|
Return True
|
|
ElseIf nameoftoken = "NotYet" Then
|
|
Return True
|
|
ElseIf nameoftoken = "Error in Session ID. It has changed. Please check admin!" Then
|
|
' Dim mailto As String = "support@verag.ag"
|
|
Dim mailto As String = "ja@verag.ag"
|
|
Dim htmlbody As String = String.Empty
|
|
VERAG_VARIABLES.seterrorcount(500)
|
|
Dim Betreff As String = "Session ID" + VERAG_VARIABLES.geterrornumb
|
|
|
|
htmlbody = "<p> Der User " + VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2")) + "hat eine ungültige oder geänderte Session-ID </p> <table><th><td>User</td></th><th><td>neue ID</td></th><tr><td>" + VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2")) + "</td><td>" + Session.SessionID + "</td></tr></table>"
|
|
|
|
VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(mailto, Betreff, htmlbody)
|
|
Return False
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
|
|
Protected Sub Image1_M_Click(sender As Object, e As ImageClickEventArgs)
|
|
MsgBox("")
|
|
End Sub
|
|
|
|
Protected Sub btn_submitpw_Click(sender As Object, e As EventArgs)
|
|
Dim tempstr As String = ""
|
|
Dim Msg, Style, Title As String
|
|
|
|
If String.IsNullOrEmpty(txt_Pw.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw_WH.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw_M.Text) = True AndAlso String.IsNullOrEmpty(txt_Pw_WH_M.Text) = True Then
|
|
|
|
txt_Pw_WH.Enabled = False
|
|
reqPassw1txt_M.Enabled = False
|
|
reqPasswtxt_M.Enabled = False
|
|
reqPasswtxt.Enabled = True
|
|
reqPassw1txt.Enabled = True
|
|
reqPasswtxt.Validate()
|
|
If reqPasswtxt.IsValid = True Then
|
|
txt_Pw_WH.Enabled = True
|
|
reqPassw1txt.Validate()
|
|
End If
|
|
|
|
Dim ConnectionString = ""
|
|
|
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
|
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
|
End If
|
|
If reqPassw1txt.IsValid = True Then
|
|
Using con As New SqlConnection(ConnectionString)
|
|
' Using cmd As New SqlCommand("Validate_User")
|
|
Using cmd As New SqlCommand("SELECT UserId,Username,Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND UserId=@UserId")
|
|
' cmd.CommandType = CommandType.StoredProcedure
|
|
Dim usrname As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2"))
|
|
Dim UsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt(Request.QueryString("Par3"))
|
|
cmd.Parameters.AddWithValue("@Username", usrname)
|
|
cmd.Parameters.AddWithValue("@UserId", UsrID)
|
|
cmd.Connection = con
|
|
con.Open()
|
|
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
|
If dr.HasRows Then
|
|
dr.Read()
|
|
If String.Equals(txt_Pw.Text, dr("Password").ToString) = False Or String.Equals(txt_Pw_WH.Text, dr("Password").ToString) = False Then
|
|
tempstr = txt_Pw.Text
|
|
Else
|
|
lbl_messagetext.Text = "Die gewählten Passwörter dürfen nicht dem alten entsprechen!"
|
|
End If
|
|
End If
|
|
dr.Close()
|
|
End Using
|
|
con.Close()
|
|
End Using
|
|
Else
|
|
VERAG_VARIABLES.seterrorcount(22)
|
|
lbl_messagetext.Text = VERAG_VARIABLES.geterrornumb + "Error bei der Passwort-Validation."
|
|
End If
|
|
|
|
Else
|
|
tempstr = "Error01"
|
|
End If
|
|
|
|
If String.Equals(txt_Pw.Text, tempstr, StringComparison.CurrentCulture) = True AndAlso String.Equals(txt_Pw_WH.Text, tempstr, StringComparison.CurrentCulture) = True AndAlso String.IsNullOrEmpty(txt_Pw_M.Text) = True And String.IsNullOrEmpty(txt_Pw_WH_M.Text) = True And String.Equals(tempstr, "Error01", StringComparison.CurrentCulture) = False Then
|
|
|
|
|
|
txt_Pw_WH_M.Enabled = False
|
|
reqPasswtxt.Enabled = False
|
|
reqPassw1txt.Enabled = False
|
|
reqPassw1txt.Enabled = True
|
|
reqPasswtxt.Enabled = True
|
|
reqPasswtxt.Validate()
|
|
If reqPasswtxt.IsValid = True Then
|
|
txt_Pw_WH.Enabled = True
|
|
reqPassw1txt.Validate()
|
|
End If
|
|
|
|
Try
|
|
Dim ConnectionString = ""
|
|
Dim usrname As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2"))
|
|
Dim UsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt(Request.QueryString("Par3"))
|
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
|
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
|
End If
|
|
If reqPassw1txt_M.IsValid = True Then
|
|
If String.Equals(txt_Pw_WH.Text, tempstr) = True AndAlso String.Equals(txt_Pw.Text, tempstr) = True AndAlso String.IsNullOrEmpty(txt_Pw_M.Text) = True And String.IsNullOrEmpty(txt_Pw_WH_M.Text) = True And String.Equals(tempstr, "Error01") = False Then
|
|
Using con As New SqlConnection(ConnectionString)
|
|
|
|
Using cmd As New SqlCommand("UPDATE [VERAG_HOMEPAGE].[dbo].[Users] SET [Password]=@Password WHERE [Username]=@Username AND [UserId]=@UserId")
|
|
' cmd.CommandType = CommandType.StoredProcedure
|
|
cmd.Parameters.AddWithValue("@Username", usrname)
|
|
cmd.Parameters.AddWithValue("@Password", txt_Pw_WH.Text)
|
|
cmd.Parameters.AddWithValue("@UserId", UsrID)
|
|
cmd.Connection = con
|
|
con.Open()
|
|
If String.IsNullOrEmpty(usrname) = False Then
|
|
cmd.ExecuteNonQuery()
|
|
btn_submitpw.Visible = True
|
|
Else
|
|
VERAG_VARIABLES.seterrorcount(25)
|
|
lbl_messagetext.Text = VERAG_VARIABLES.geterrornumb() + "Fehler bei der Behebung des Passwortwechsels."
|
|
End If
|
|
End Using
|
|
con.Close()
|
|
End Using
|
|
End If
|
|
Else
|
|
VERAG_VARIABLES.seterrorcount(22)
|
|
lbl_messagetext_M.ForeColor = Drawing.Color.Red
|
|
lbl_messagetext_M.Text = VERAG_VARIABLES.geterrornumb() + "Error bei der Validierung des Kennwortes."
|
|
End If
|
|
Catch ex As Exception
|
|
lbl_messagetext.Text = ex.Message
|
|
End Try
|
|
Msg = "PW erfolgreich geändert!"
|
|
Style = vbOKOnly + vbInformation + vbDefaultButton1
|
|
Title = "Information"
|
|
regexval_txt_Pw.ForeColor = Drawing.Color.Green
|
|
regexval_txt_Pw.Text = "Passwort wurde erfolgreich geändert!"
|
|
'MsgBox(Msg, Style, Title)
|
|
' If MsgBox(Msg, Style, Title).Ok Then
|
|
'Response.Redirect("login_FLEX.aspx")
|
|
'End If
|
|
ElseIf tempstr = "Error01" Then
|
|
regexval_txt_Pw.ForeColor = Drawing.Color.MediumVioletRed
|
|
VERAG_VARIABLES.seterrorcount(2)
|
|
regexval_txt_Pw.Text = VERAG_VARIABLES.geterrornumb + "Passwort konnte nicht erfolgreich geändert werden!"
|
|
' Msg = "PW nicht erfolgreich geändert!"
|
|
' Style = vbAbortRetryIgnore + vbCritical + vbDefaultButton1
|
|
' Title = "Error"
|
|
'MsgBox(Msg, Style, Title)
|
|
'If MsgBox(Msg, Style, Title).Retry Then
|
|
'Response.Redirect(Request.RawUrl)
|
|
'ElseIf MsgBox(Msg, Style, Title).Abort Then
|
|
' Response.Redirect("../newPageJulius_Sidebar.aspx")
|
|
'ElseIf MsgBox(Msg, Style, Title).Ignore Then
|
|
' Try
|
|
' Catch ex As Exception
|
|
' End Try
|
|
End If
|
|
End Sub
|
|
Protected Sub txt_Pw_WH_TextChanged(sender As Object, e As EventArgs)
|
|
regexval_txt_Pw_WH.Validate()
|
|
confirmPasswordReq.Validate()
|
|
If confirmPasswordReq.IsValid Then
|
|
' btn_submitpw.Enabled = True
|
|
Else
|
|
lbl_messagetext.ForeColor = Drawing.Color.Red
|
|
lbl_messagetext.Text = "Passwörter stimmen nicht überein."
|
|
'btn_submitpw.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub txt_Pw_TextChanged(sender As Object, e As EventArgs)
|
|
regexval_txt_Pw.Validate()
|
|
If regexval_txt_Pw.IsValid Then
|
|
txt_Pw_WH.ReadOnly = False
|
|
regexval_txt_Pw_WH.Enabled = True
|
|
Else
|
|
txt_Pw_WH.ReadOnly = True
|
|
regexval_txt_Pw_WH.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub txt_Pw_M_TextChanged(sender As Object, e As EventArgs)
|
|
regexval_txt_Pw_M.Validate()
|
|
If regexval_txt_Pw_M.IsValid Then
|
|
txt_Pw_WH_M.ReadOnly = False
|
|
regexval_txt_Pw_WH_M.Enabled = True
|
|
Else
|
|
txt_Pw_WH_M.ReadOnly = True
|
|
regexval_txt_Pw_WH_M.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub txt_Pw_WH_M_TextChanged(sender As Object, e As EventArgs)
|
|
regexval_txt_Pw_WH_M.Validate()
|
|
confirmPasswordReq_M.Validate()
|
|
If confirmPasswordReq_M.IsValid Then
|
|
'btn_submitpw_M.Enabled = True
|
|
Else
|
|
lbl_messagetext_M.ForeColor = Drawing.Color.Red
|
|
lbl_messagetext_M.Text = "Passwörter stimmen nicht überein."
|
|
'btn_submitpw.Enabled = False
|
|
End If
|
|
End Sub
|
|
|
|
Protected Sub btn_submitpw_M_Click(sender As Object, e As EventArgs)
|
|
Dim tempstr As String = ""
|
|
Dim ConnectionString = ""
|
|
If String.IsNullOrEmpty(txt_Pw_M.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw_WH_M.Text) = False AndAlso String.IsNullOrEmpty(txt_Pw.Text) = True AndAlso String.IsNullOrEmpty(txt_Pw_WH.Text) = True Then
|
|
reqPasswtxt.Enabled = False
|
|
reqPasswtxt.Enabled = False
|
|
reqPasswtxt_M.Enabled = True
|
|
reqPassw1txt_M.Enabled = True
|
|
reqPasswtxt_M.Validate()
|
|
reqPassw1txt_M.Validate()
|
|
|
|
If reqPasswtxt_M.IsValid = True AndAlso reqPassw1txt_M.IsValid = True Then
|
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
|
|
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
|
End If
|
|
Using con As New SqlConnection(ConnectionString)
|
|
' Using cmd As New SqlCommand("Validate_User")
|
|
Using cmd As New SqlCommand("SELECT UserId,Username,Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND UserId=@UserId And UserId=@UserId")
|
|
' cmd.CommandType = CommandType.StoredProcedure
|
|
Dim usrname As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2")).ToString
|
|
Dim UsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt(Request.QueryString("Par3")).ToString
|
|
Dim THEUsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par4")).ToString
|
|
cmd.Parameters.AddWithValue("@Username", usrname)
|
|
cmd.Parameters.AddWithValue("@UserId", UsrID)
|
|
cmd.Connection = con
|
|
con.Open()
|
|
' userId = Convert.ToInt32(cmd.ExecuteScalar())
|
|
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
|
If dr.HasRows Then
|
|
dr.Read()
|
|
If String.Equals(txt_Pw_M.Text, dr("Password").ToString, StringComparison.CurrentCulture) = False Or String.Equals(txt_Pw_WH_M.Text, dr("Password").ToString, StringComparison.CurrentCulture) = False Then
|
|
tempstr = txt_Pw_M.Text
|
|
Else
|
|
lbl_messagetext_M.ForeColor = Drawing.Color.Red
|
|
lbl_messagetext_M.Text = "Die gewählten Passwörter dürfen nicht dem alten entsprechen!"
|
|
End If
|
|
End If
|
|
dr.Close()
|
|
End Using
|
|
con.Close()
|
|
End Using
|
|
Else
|
|
tempstr = "Error01"
|
|
End If
|
|
If String.Equals(txt_Pw_WH_M.Text, tempstr) = True AndAlso String.Equals(txt_Pw_M.Text, tempstr) = True AndAlso String.IsNullOrEmpty(txt_Pw.Text) = True And String.IsNullOrEmpty(txt_Pw_WH.Text) = True And String.Equals(tempstr, "Error01") = False Then
|
|
Try
|
|
ConnectionString = ""
|
|
Dim usrname As String = VERAG_PROG_ALLGEMEIN.cCryptography.Decrypt(Request.QueryString("Par2")).ToString
|
|
Dim UsrID As String = VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt(Request.QueryString("Par3")).ToString
|
|
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
|
|
'ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=sa;Pwd=BmWr501956"
|
|
ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
Else
|
|
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
|
|
'ConnectionString = "Server=db593295684.db.1and1.com;Database=db593295684;Uid=dbo593295684;Pwd=atilla#2;"
|
|
End If
|
|
Using con As New SqlConnection(ConnectionString)
|
|
|
|
Using cmd As New SqlCommand("UPDATE [VERAG_HOMEPAGE].[dbo].[Users] SET Password=@Password WHERE Username=@Username AND UserId=@UserId")
|
|
' cmd.CommandType = CommandType.StoredProcedure
|
|
cmd.Parameters.AddWithValue("@Username", usrname)
|
|
cmd.Parameters.AddWithValue("@Password", txt_Pw_WH_M.Text)
|
|
cmd.Parameters.AddWithValue("@UserId", UsrID)
|
|
cmd.Connection = con
|
|
con.Open()
|
|
If String.Equals(usrname, VERAG_PROG_ALLGEMEIN.cCryptography2.Decrypt("Par2"), CompareMethod.Text) = True Then
|
|
cmd.ExecuteNonQuery()
|
|
regexval_txt_Pw_M.ForeColor = Drawing.Color.Green
|
|
regexval_txt_Pw_M.Text = "Passwort wurde erfolgreich geändert!"
|
|
End If
|
|
End Using
|
|
con.Close()
|
|
End Using
|
|
Catch ex As Exception
|
|
lbl_messagetext_M.Text = ex.Message
|
|
End Try
|
|
|
|
'MsgBox(Msg, Style, Title)
|
|
|
|
' If MsgBox(Msg, Style, Title).Ok Then
|
|
'Response.Redirect("login_FLEX.aspx")
|
|
'End If
|
|
ElseIf tempstr = "Error01" Then
|
|
regexval_txt_Pw_M.ForeColor = Drawing.Color.MediumVioletRed
|
|
VERAG_VARIABLES.seterrorcount(2)
|
|
regexval_txt_Pw_M.Text = VERAG_VARIABLES.geterrornumb + "Passwort konnte nicht erfolgreich geändert werden!"
|
|
' Msg = "PW nicht erfolgreich geändert!"
|
|
' Style = vbAbortRetryIgnore + vbCritical + vbDefaultButton1
|
|
' Title = "Error"
|
|
'MsgBox(Msg, Style, Title)
|
|
'If MsgBox(Msg, Style, Title).Retry Then
|
|
'Response.Redirect(Request.RawUrl)
|
|
'ElseIf MsgBox(Msg, Style, Title).Abort Then
|
|
' Response.Redirect("../newPageJulius_Sidebar.aspx")
|
|
'ElseIf MsgBox(Msg, Style, Title).Ignore Then
|
|
' Try
|
|
|
|
' Catch ex As Exception
|
|
|
|
' End Try
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class |