Änderungen design login pages
This commit is contained in:
@@ -7,39 +7,47 @@ Imports System.Data
|
||||
|
||||
Partial Class login_ForgotPW
|
||||
Inherits System.Web.UI.Page
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs)
|
||||
End Sub
|
||||
|
||||
Protected Sub btn_Back_Click(sender As Object, e As EventArgs)
|
||||
Response.Redirect("login/login_FLEX.aspx")
|
||||
End Sub
|
||||
|
||||
Protected Sub SendEmail(sender As Object, e As EventArgs)
|
||||
Dim username As String = txt_Username.Text
|
||||
Dim password As String = String.Empty
|
||||
Dim email As String = txtEmail.Text
|
||||
Dim tokenname As String = ""
|
||||
Protected Sub btn_Send_Click(sender As Object, e As EventArgs)
|
||||
Dim username As String
|
||||
Dim password As String
|
||||
Dim email As String
|
||||
Dim tokenname As String
|
||||
Try
|
||||
username = txt_Username.Text
|
||||
password = String.Empty
|
||||
email = txtEmail.Text
|
||||
tokenname = ""
|
||||
Catch Excep As MissingFieldException
|
||||
MsgBox("Error05: " + Excep.Message)
|
||||
End Try
|
||||
|
||||
'cDBFunctions.GetNewOpenConnection()
|
||||
Dim ConnectionString = String.Empty
|
||||
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
|
||||
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
||||
Using con As New SqlConnection(ConnectionString)
|
||||
' Using cmd As New SqlCommand("Validate_User")
|
||||
Using cmd As New SqlCommand("SELECT Username,Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username")
|
||||
' cmd.CommandType = CommandType.StoredProcedure
|
||||
cmd.Parameters.AddWithValue("@Username", username)
|
||||
cmd.Connection = con
|
||||
con.Open()
|
||||
'userId = Convert.ToInt32(cmd.ExecuteScalar())
|
||||
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
||||
If dr.Read() Then
|
||||
username = dr("Username").ToString()
|
||||
password = dr("Password").ToString()
|
||||
'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
|
||||
' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString
|
||||
Using con As New SqlConnection(ConnectionString)
|
||||
' Using cmd As New SqlCommand("Validate_User")
|
||||
Using cmd As New SqlCommand("SELECT Username,Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username")
|
||||
' cmd.CommandType = CommandType.StoredProcedure
|
||||
cmd.Parameters.AddWithValue("@Username", username)
|
||||
cmd.Connection = con
|
||||
con.Open()
|
||||
'userId = Convert.ToInt32(cmd.ExecuteScalar())
|
||||
Dim dr As SqlDataReader = cmd.ExecuteReader()
|
||||
If dr.Read() Then
|
||||
username = dr("Username").ToString()
|
||||
password = dr("Password").ToString()
|
||||
Try
|
||||
email = txtEmail.Text
|
||||
Catch ex As Exception
|
||||
@@ -55,28 +63,28 @@ Partial Class login_ForgotPW
|
||||
End If
|
||||
End Try
|
||||
End If
|
||||
End Using
|
||||
con.Close()
|
||||
End Using
|
||||
tokenname = genToken(username, password, email)
|
||||
If SendEmail(username, password, email, tokenname) = True Then
|
||||
'password = RandomString(New Random, 10)
|
||||
If (getDateoftoken(tokenname) = True) Then
|
||||
con.Close()
|
||||
End Using
|
||||
tokenname = genToken(username, password, email)
|
||||
If SendEmail(username, password, email, tokenname) = True Then
|
||||
'password = RandomString(New Random, 10)
|
||||
If (getDateoftoken(tokenname) = True) Then
|
||||
Dim msgboxstyle = vbDefaultButton1 + vbOK
|
||||
MsgBox(tokenname, msgboxstyle)
|
||||
Else
|
||||
MsgBox("token nicht mehr Gültig! Neuer wird generiert!")
|
||||
tokenname = genToken(username, password, email)
|
||||
End If
|
||||
'SendEmail(username, password, email)
|
||||
MsgBox("Mail would be sent successfully!")
|
||||
lblMessage.ForeColor = Color.Green
|
||||
lblMessage.Text = "Passwort wurde erfolgreich an die angegebene E-Mail Adresse gesendet."
|
||||
ElseIf SendEmail(username, password, email, tokenname) = False Then
|
||||
MsgBox("Mail would not be sent successfully!")
|
||||
lblMessage.ForeColor = Color.Red
|
||||
lblMessage.Text = "Diese E-Mail ist nicht in unserer Datenbank vorhanden."
|
||||
Else
|
||||
MsgBox("token nicht mehr Gültig! Neuer wird generiert!")
|
||||
tokenname = genToken(username, password, email)
|
||||
End If
|
||||
'SendEmail(username, password, email)
|
||||
MsgBox("Mail would be sent successfully!")
|
||||
lblMessage.ForeColor = Color.Green
|
||||
lblMessage.Text = "Passwort wurde erfolgreich an die angegebene E-Mail Adresse gesendet."
|
||||
ElseIf SendEmail(username, password, email, tokenname) = False Then
|
||||
MsgBox("Mail would not be sent successfully!")
|
||||
lblMessage.ForeColor = Color.Red
|
||||
lblMessage.Text = "Diese E-Mail ist nicht in unserer Datenbank vorhanden."
|
||||
End If
|
||||
End Sub
|
||||
|
||||
'Function RandomString(r As Random, max As Integer) As String
|
||||
@@ -182,6 +190,6 @@ Partial Class login_ForgotPW
|
||||
End Function
|
||||
|
||||
Protected Sub txtEmail_TextChanged(sender As Object, e As EventArgs)
|
||||
regexval_txt_Email.Validate()
|
||||
regexval_txt_Email.ValidateRequestMode = UI.ValidateRequestMode.Enabled
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user