Token-Generierung Verbesserungen und Message Box Antworten-Evalition.

This commit is contained in:
ja
2021-10-07 09:23:14 +02:00
parent 33a6aab22d
commit 5622a00045
2 changed files with 16 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ Partial Class login_ChangePW
Protected Sub btn_submitpw_Click(sender As Object, e As EventArgs)
Dim tempstr As String = ""
Dim Msg, Style, Title, Help, Ctxt, MsgResponse, MyString
Dim Msg, Style, Title As String
reqPasswtxt.Validate()
reqPassw1txt.Validate()
If confirmPasswordReq.IsValid = True Then
@@ -63,16 +63,12 @@ Partial Class login_ChangePW
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
End Class

View File

@@ -109,11 +109,23 @@ Partial Class login_ForgotPW
Return False
End Function
Function genToken() As String
Function genToken(username As String, password As String, email As String) As String
Dim time() As Byte = BitConverter.GetBytes(DateTime.UtcNow.ToBinary())
Dim Key() As Byte = Guid.NewGuid().ToByteArray()
Dim token As String = Convert.ToBase64String(time.Concat(Key).ToArray())
Return token
Try
Dim token As String = Convert.ToBase64String(time.Concat(Key).ToArray())
Return token
Catch Ex As Exception
Dim Msg, Style, Title As String
Msg = "Tokengenerierung fehlgeschlagen!" & vbCrLf & "Eine E-Mail wurde erneut an " + email + " zugesedet."
Style = vbRetry + vbExclamation + vbDefaultButton1
Title = "Fehler bei Token-Generierung"
MsgBox(Msg, Style, Title)
If MsgBox(Msg, Style, Title).Retry Then
SendEmail(username, password, email)
End If
End Try
End Function
Function getDateoftoken(tokenname As String) As Boolean