Änderungen Login Screen

This commit is contained in:
ja
2022-02-14 09:48:52 +01:00
parent 4c501200af
commit 29ff248be1

View File

@@ -232,6 +232,7 @@ Partial Class login_FLEX
Session.Add("CustomerID", Customer_ID) Session.Add("CustomerID", Customer_ID)
Session.Add("PW", passw) Session.Add("PW", passw)
Exit Select Exit Select
setDBLastLoggedIn(tb2.Text)
End Select End Select
End If End If
dr.Close() dr.Close()
@@ -246,6 +247,7 @@ Partial Class login_FLEX
'Dim str = gensaltToken(UserNaMe, passw, Customer_ID, Session.IsNewSession) 'Dim str = gensaltToken(UserNaMe, passw, Customer_ID, Session.IsNewSession)
'MsgBox(str) 'MsgBox(str)
'End If 'End If
FormsAuthentication.RedirectFromLoginPage(UserNaMe, True) FormsAuthentication.RedirectFromLoginPage(UserNaMe, True)
End Sub End Sub
Protected Async Sub ValidateUser_M(sender As Object, e As EventArgs) Handles Login2.Authenticate Protected Async Sub ValidateUser_M(sender As Object, e As EventArgs) Handles Login2.Authenticate
@@ -373,7 +375,7 @@ Partial Class login_FLEX
VERAG_VARIABLES.seterrorcount(9) VERAG_VARIABLES.seterrorcount(9)
Login2.FailureText = VERAG_VARIABLES.geterrornumb + "Password is not in the Database!" Login2.FailureText = VERAG_VARIABLES.geterrornumb + "Password is not in the Database!"
End If End If
setDBLastLoggedIn_M(UserNaMe)
'MsgBox("Erfolgreich validiert.") 'MsgBox("Erfolgreich validiert.")
Session.Add("test", UserNaMe) Session.Add("test", UserNaMe)
Session.Add("CustomerID", Customer_ID) Session.Add("CustomerID", Customer_ID)
@@ -388,6 +390,7 @@ Partial Class login_FLEX
If String.IsNullOrEmpty(tb2.Text) = False AndAlso String.IsNullOrEmpty(tb2_M.Text) = True Then If String.IsNullOrEmpty(tb2.Text) = False AndAlso String.IsNullOrEmpty(tb2_M.Text) = True Then
FormsAuthentication.SetAuthCookie(Login2.UserName, cb_M.Checked) FormsAuthentication.SetAuthCookie(Login2.UserName, cb_M.Checked)
setDBLastLoggedIn_M(tb2_M.Text)
End If End If
'If (String.IsNullOrEmpty(passw) = False And String.IsNullOrEmpty(UserNaMe) = False And String.IsNullOrEmpty(Customer_ID) = False) Then 'If (String.IsNullOrEmpty(passw) = False And String.IsNullOrEmpty(UserNaMe) = False And String.IsNullOrEmpty(Customer_ID) = False) Then
'Dim str = gensaltToken(UserNaMe, passw, Customer_ID, Session.IsNewSession) 'Dim str = gensaltToken(UserNaMe, passw, Customer_ID, Session.IsNewSession)
@@ -449,30 +452,50 @@ Partial Class login_FLEX
TestPerformance.createnUsers(Integer.Parse(str)) TestPerformance.createnUsers(Integer.Parse(str))
End Sub End Sub
Protected Sub setDBLastLoggedIn(Username As String) Protected Sub setDBLastLoggedIn(UserName As String)
Dim ConnectionString = "" Dim ConnectionString = ""
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then 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$;" ConnectionString = "Server=DEVELOPER\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;"
Else Else
ConnectionString = "Server=DEVELOPER.verag.ost.dmn\DEVSQL;Database=VERAG_HOMEPAGE;Uid=AppUser;Pwd=yp/THDd?xM+pZ$;" 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 End If
Using con As New SqlConnection(ConnectionString) Using con As New SqlConnection(ConnectionString)
Using cmd As New SqlCommand("Update VERAG_HOMEPAGE.dbo.Users SET [LastLoginDate]='@VALUE' WHERE Username='@Username'")
Using cmd As New SqlCommand("insert into [VERAG_HOMEPAGE].[dbo].[Users] ([LastLoginDate]) values ('" & Date.Now.ToString & "')") cmd.Parameters.AddWithValue("@Username", UserName)
' cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.AddWithValue("@VALUE", Date.Now.ToString)
cmd.Parameters.AddWithValue("@Username", Login1.UserName)
cmd.Parameters.AddWithValue("@Password", VERAG_PROG_ALLGEMEIN.cCryptography.Encrypt(Login1.Password))
cmd.Connection = con cmd.Connection = con
con.Open() con.Open()
Try Try
con.ConnectionString = "Data Source=TYNE-PC;Initial Catalog=trial;Integrated Security=True"
con.Open() con.Open()
cmd.Connection = con cmd.Connection = con
cmd.ExecuteNonQuery() cmd.ExecuteNonQuery()
Catch ex As Exception
Finally
con.Close()
End Try
End Using
End Using
End Sub
Protected Sub setDBLastLoggedIn_M(UserName As String)
Dim ConnectionString = ""
If HttpContext.Current.Request.ServerVariables("SERVER_NAME") = "localhost" Then
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$;"
End If
Using con As New SqlConnection(ConnectionString)
Using cmd As New SqlCommand("Update VERAG_HOMEPAGE.dbo.Users SET [LastLoginDate]='@VALUE' WHERE Username='@Username'")
' cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Username", UserName)
cmd.Parameters.AddWithValue("@VALUE", Date.Now.ToString)
cmd.Connection = con
con.Open()
Try
cmd.Connection = con
cmd.ExecuteNonQuery()
Catch ex As Exception Catch ex As Exception
@@ -481,6 +504,5 @@ Partial Class login_FLEX
End Try End Try
End Using End Using
End Using End Using
End Sub End Sub
End Class End Class