Email Validierung verbessert.
This commit is contained in:
@@ -72,10 +72,10 @@ Partial Class login_ForgotPW
|
|||||||
End Using
|
End Using
|
||||||
con.Close()
|
con.Close()
|
||||||
End Using
|
End Using
|
||||||
|
tokenname = genToken(username, password, email)
|
||||||
If Not String.IsNullOrEmpty(username) Then
|
If SendEmail(username, password, email) = True Then
|
||||||
'password = RandomString(New Random, 10)
|
'password = RandomString(New Random, 10)
|
||||||
tokenname = genToken(username, password, email)
|
|
||||||
'If (getDateoftoken(tokenname) = True) Then
|
'If (getDateoftoken(tokenname) = True) Then
|
||||||
'Dim msgboxstyle = vbDefaultButton1 + vbOK
|
'Dim msgboxstyle = vbDefaultButton1 + vbOK
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ Partial Class login_ForgotPW
|
|||||||
MsgBox("Mail would be sent successfully!")
|
MsgBox("Mail would be sent successfully!")
|
||||||
lblMessage.ForeColor = Color.Green
|
lblMessage.ForeColor = Color.Green
|
||||||
lblMessage.Text = "Passwort wurde erfolgreich an die angegebene E-Mail Adresse gesendet."
|
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!")
|
MsgBox("Mail would not be sent successfully!")
|
||||||
lblMessage.ForeColor = Color.Red
|
lblMessage.ForeColor = Color.Red
|
||||||
lblMessage.Text = "Diese E-Mail ist nicht in unserer Datenbank vorhanden."
|
lblMessage.Text = "Diese E-Mail ist nicht in unserer Datenbank vorhanden."
|
||||||
@@ -121,15 +121,19 @@ Partial Class login_ForgotPW
|
|||||||
mySmtpsvr.Credentials = myCredentials
|
mySmtpsvr.Credentials = myCredentials
|
||||||
|
|
||||||
Try
|
Try
|
||||||
'genToken(username, password, email)
|
Dim tokennametemp = genToken(username, password, email)
|
||||||
Msg.From = New MailAddress("al@verag.ag")
|
If getDateoftoken(tokennametemp) = True Then
|
||||||
Msg.To.Add(email)
|
Msg.From = New MailAddress("al@verag.ag")
|
||||||
Msg.Subject = "Passwort reset"
|
Msg.To.Add(email)
|
||||||
Msg.Body = String.Format("Sehr geehrte/r {0},<br /><br /> Der Link zum Zurücksetzen des Passwortes lautet:<br /><br /><br />.<br />" + Environment.NewLine + lkb.PostBackUrl + Environment.NewLine + "<br />Mit freundlichen Grüßen,", username, password)
|
Msg.Subject = "Passwort reset"
|
||||||
' Dim attachment As Attachment = New Attachment(File.OpenRead(excel), "Kundenliste.xlsx")
|
Msg.Body = String.Format("Sehr geehrte/r {0},<br /><br /> Der Link zum Zurücksetzen des Passwortes lautet:<br /><br /><br />.<br />" + Environment.NewLine + lkb.PostBackUrl + Environment.NewLine + "<br />Mit freundlichen Grüßen,", username, password)
|
||||||
' Msg.Attachments.Add(attachment)
|
' Dim attachment As Attachment = New Attachment(File.OpenRead(excel), "Kundenliste.xlsx")
|
||||||
mySmtpsvr.Send(Msg)
|
' Msg.Attachments.Add(attachment)
|
||||||
MsgBox("SENT")
|
mySmtpsvr.Send(Msg)
|
||||||
|
MsgBox("SENT")
|
||||||
|
Else
|
||||||
|
Return False
|
||||||
|
End If
|
||||||
Return True
|
Return True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
MsgBox(Err.Number & ex.Message & ex.StackTrace.ToString) 'Falls ein Fehler auftritt wird eine MsgBox angezeigt
|
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)
|
MsgBox(Msg, Style, Title)
|
||||||
|
|
||||||
If MsgBox(Msg, Style, Title).Retry Then
|
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 If
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|||||||
Reference in New Issue
Block a user