Ä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("PW", passw)
Exit Select
setDBLastLoggedIn(tb2.Text)
End Select
End If
dr.Close()
@@ -246,6 +247,7 @@ Partial Class login_FLEX
'Dim str = gensaltToken(UserNaMe, passw, Customer_ID, Session.IsNewSession)
'MsgBox(str)
'End If
FormsAuthentication.RedirectFromLoginPage(UserNaMe, True)
End Sub
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)
Login2.FailureText = VERAG_VARIABLES.geterrornumb + "Password is not in the Database!"
End If
setDBLastLoggedIn_M(UserNaMe)
'MsgBox("Erfolgreich validiert.")
Session.Add("test", UserNaMe)
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
FormsAuthentication.SetAuthCookie(Login2.UserName, cb_M.Checked)
setDBLastLoggedIn_M(tb2_M.Text)
End If
'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)
@@ -449,30 +452,50 @@ Partial Class login_FLEX
TestPerformance.createnUsers(Integer.Parse(str))
End Sub
Protected Sub setDBLastLoggedIn(Username As String)
Protected Sub setDBLastLoggedIn(UserName As String)
Dim ConnectionString = ""
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("insert into [VERAG_HOMEPAGE].[dbo].[Users] ([LastLoginDate]) values ('" & Date.Now.ToString & "')")
' cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Username", Login1.UserName)
cmd.Parameters.AddWithValue("@Password", VERAG_PROG_ALLGEMEIN.cCryptography.Encrypt(Login1.Password))
Using cmd As New SqlCommand("Update VERAG_HOMEPAGE.dbo.Users SET [LastLoginDate]='@VALUE' WHERE Username='@Username'")
cmd.Parameters.AddWithValue("@Username", UserName)
cmd.Parameters.AddWithValue("@VALUE", Date.Now.ToString)
cmd.Connection = con
con.Open()
Try
con.ConnectionString = "Data Source=TYNE-PC;Initial Catalog=trial;Integrated Security=True"
con.Open()
cmd.Connection = con
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
@@ -481,6 +504,5 @@ Partial Class login_FLEX
End Try
End Using
End Using
End Sub
End Class