Email Validierung verbessert.

This commit is contained in:
ja
2021-10-07 10:15:25 +02:00
parent 2a33fd86da
commit 4bcff2222e

View File

@@ -72,10 +72,10 @@ Partial Class login_ForgotPW
End Using
con.Close()
End Using
If Not String.IsNullOrEmpty(username) Then
'password = RandomString(New Random, 10)
tokenname = genToken(username, password, email)
If SendEmail(username, password, email) = True Then
'password = RandomString(New Random, 10)
'If (getDateoftoken(tokenname) = True) Then
'Dim msgboxstyle = vbDefaultButton1 + vbOK
@@ -88,7 +88,7 @@ Partial Class login_ForgotPW
MsgBox("Mail would be sent successfully!")
lblMessage.ForeColor = Color.Green
lblMessage.Text = "Passwort wurde erfolgreich an die angegebene E-Mail Adresse gesendet."
Else
ElseIf SendEmail(username, password, email) = False Then
MsgBox("Mail would not be sent successfully!")
lblMessage.ForeColor = Color.Red
lblMessage.Text = "Diese E-Mail ist nicht in unserer Datenbank vorhanden."
@@ -121,7 +121,8 @@ Partial Class login_ForgotPW
mySmtpsvr.Credentials = myCredentials
Try
'genToken(username, password, email)
Dim tokennametemp = genToken(username, password, email)
If getDateoftoken(tokennametemp) = True Then
Msg.From = New MailAddress("al@verag.ag")
Msg.To.Add(email)
Msg.Subject = "Passwort reset"
@@ -130,6 +131,9 @@ Partial Class login_ForgotPW
' Msg.Attachments.Add(attachment)
mySmtpsvr.Send(Msg)
MsgBox("SENT")
Else
Return False
End If
Return True
Catch ex As Exception
MsgBox(Err.Number & ex.Message & ex.StackTrace.ToString) 'Falls ein Fehler auftritt wird eine MsgBox angezeigt
@@ -152,7 +156,11 @@ Partial Class login_ForgotPW
MsgBox(Msg, Style, Title)
If MsgBox(Msg, Style, Title).Retry Then
SendEmail(username, password, email)
If SendEmail(username, password, email) = True Then
MsgBox("SENT")
Else
MsgBox("Error02: Mail not delivered!")
End If
End If
End Try
End Function