diff --git a/login/ForgotPW.aspx.vb b/login/ForgotPW.aspx.vb index 807a566..d1067fd 100644 --- a/login/ForgotPW.aspx.vb +++ b/login/ForgotPW.aspx.vb @@ -61,12 +61,12 @@ Partial Class login_ForgotPW Msg = "E-Mail validation failed!" & vbCrLf + "Please try again!" Style = vbRetry + vbExclamation + vbDefaultButton1 Title = "Authentication error!" - MsgBox(Msg, Style, Title) - If MsgBox(Msg, Style, Title).Yes Then - txtEmail.Text = String.Empty - txtEmail.Focus() - ElseIf MsgBox(Msg, Style, Title).No Then - End If + 'MsgBox(Msg, Style, Title) + 'If MsgBox(Msg, Style, Title).Yes Then + 'txtEmail.Text = String.Empty + 'txtEmail.Focus() + 'ElseIf MsgBox(Msg, Style, Title).No Then + 'End If End Try End If End Using @@ -78,11 +78,16 @@ Partial Class login_ForgotPW If SendEmail(username, password, email, tokenname) = True Then 'password = RandomString(New Random, 10) If (getDateoftoken(tokenname) = True) Then - Dim msgboxstyle = vbDefaultButton1 + vbOK + 'Dim msgboxstyle = vbDefaultButton1 + vbOK 'MsgBox(tokenname, msgboxstyle) - MsgBox("Token generated successfully.") + lblMessage.ForeColor = Color.Green + lblMessage.Text = "Token generated successfully." + 'MsgBox("Token generated successfully.") Else - MsgBox("Token is not valid anymore. Please generate a new one by sending a new e-mail!") + lblMessage.ForeColor = Color.Red + lblMessage.Text = "Token is not valid anymore. Please generate a new one by sending a new e-mail!" + 'MsgBox("Token is not valid anymore. Please generate a new one by sending a new e-mail!") + tokenname = genToken(username, password, email) End If 'SendEmail(username, password, email) @@ -126,14 +131,14 @@ Partial Class login_ForgotPW 'pagename = Request.ServerVariables("SCRIPT_NAME") mailto = email Betreff = "Passwort reset" - htmlbody = String.Format("Dear, {0},

Please follow the Link to reset your password:


.
" + Environment.NewLine + "Link" + Environment.NewLine + "
Kind regards,
VERAG | EDV Support
support@verag.ag,", username, password) + htmlbody = String.Format("Dear, {0},

Please follow the Link to reset your password:

" + Environment.NewLine + "Link" + Environment.NewLine + "
Kind regards,
VERAG | EDV Support
support@verag.ag,", username, password) ElseIf String.IsNullOrWhiteSpace(HttpContext.Current.Request.ServerVariables("SERVER_NAME")) = False Then getdomianenvironment = HttpContext.Current.Request.ServerVariables("SERVER_NAME") ServPort = String.Empty 'pagename = Request.ServerVariables("SCRIPT_NAME") mailto = email Betreff = "Passwort reset" - htmlbody = String.Format("Dear, {0},

Please follow the Link to reset your password:


.
" + Environment.NewLine + "Link" + Environment.NewLine + "
Kind regards,
VERAG | EDV Support
support@verag.ag,", username, password) + htmlbody = String.Format("Dear, {0},

Please follow the Link to reset your password:

" + Environment.NewLine + "Link" + Environment.NewLine + "
Kind regards,
VERAG | EDV Support
support@verag.ag,", username, password) ElseIf String.IsNullOrWhiteSpace(HttpContext.Current.Request.ServerVariables("SERVER_NAME")) = True Then MsgBox("Error09:" + Environment.NewLine + " The Domain could not be vaildated. Check Link please or contact the Administrator of the program.") End If @@ -149,18 +154,22 @@ Partial Class login_ForgotPW If String.IsNullOrEmpty(mailto) = False AndAlso String.IsNullOrEmpty(Betreff) = False AndAlso String.IsNullOrEmpty(htmlbody) = False Then VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(mailto, Betreff, htmlbody) Else - MsgBox("Error07: Die Paramter wurden nicht alle gesetzt. Bitte Felder überprüfen.", vbAbort, "Error07") + 'MsgBox("Error07: Die Paramter wurden nicht alle gesetzt. Bitte Felder überprüfen.", vbAbort, "Error07") + lblMessage.ForeColor = Color.OrangeRed + lblMessage.Text = "Error07: Die Paramter wurden nicht alle gesetzt. Bitte Felder überprüfen!" End If MsgBox("SENT") - Return True - Else - MsgBox("Error02: Mail not delivered!" & vbCrLf & "New Token has been generated.") + Return True + Else + lblMessage.ForeColor = Color.Red + lblMessage.Text = "Error02: Mail not delivered!" + 'MsgBox("Error02: Mail not delivered!" & vbCrLf & "New Token has been generated.") tokennametemp = genToken(username, password, email) VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(mailto, Betreff, htmlbody, tokenname) Return False End If 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 End Try Return False End Function @@ -177,26 +186,26 @@ Partial Class login_ForgotPW Msg = "Token Generation failed" & vbCrLf & "A new E-mail has been sent to the intern e-mail given." Style = vbRetry + vbExclamation + vbDefaultButton1 Title = "Error05: Token-Generierung" - MsgBox(Msg, Style, Title) + 'MsgBox(Msg, Style, Title) - If MsgBox(Msg, Style, Title).Retry Then - genToken(username, password, email) - If SendEmail(username, password, email, token) = False Then - MsgBox("Email could not been sent because of an internal encryption error.", vbOK + vbInformation + vbDefaultButton1, "Token-Generation Error") - Else - MsgBox("Email has been sent successful." & vbCr & "Please check your E-Mails!", vbOK + vbInformation + vbDefaultButton1, "Token-Generation successful!") - End If + 'If MsgBox(Msg, Style, Title).Retry Then + 'genToken(username, password, email) + If SendEmail(username, password, email, token) = False Then + 'MsgBox("Email could not been sent because of an internal encryption error.", vbOK + vbInformation + vbDefaultButton1, "Token-Generation Error") Else - MsgBox("Token-Generation has not been successful." & vbCrLf & "Please try again in five seconds!") - Dim jetzt As DateTime = DateTime.UtcNow - Dim wenn As DateTime = DateTime.UtcNow.AddSeconds(-5) + 'MsgBox("Email has been sent successful." & vbCr & "Please check your E-Mails!", vbOK + vbInformation + vbDefaultButton1, "Token-Generation successful!") + End If + 'Else + 'MsgBox("Token-Generation has not been successful." & vbCrLf & "Please try again in five seconds!") + Dim jetzt As DateTime = DateTime.UtcNow + Dim wenn As DateTime = DateTime.UtcNow.AddSeconds(-5) - If jetzt < wenn Then - Return "NotYet" - Else - token = Convert.ToBase64String(time.Concat(Key).ToArray()) - Return token - End If + If jetzt < wenn Then + 'Return "NotYet" + 'Else + token = genToken(username, password, email) + Return token + 'End If End If End Try End Function @@ -206,7 +215,8 @@ Partial Class login_ForgotPW Dim wenn As DateTime = DateTime.FromBinary(BitConverter.ToInt64(data, 0)) If wenn < DateTime.UtcNow.AddMinutes(-30) Then tokenname = String.Empty - MsgBox("Token has not been found or is too old!" + Environment.NewLine + "Please send a new E-mail!") + + 'MsgBox("Token has not been found or is too old!" + Environment.NewLine + "Please send a new E-mail!") Return False ElseIf tokenname = "NotYet" Then Return False