From cfcc25c13b4f06b55417246233a877ba91614161 Mon Sep 17 00:00:00 2001 From: ja Date: Tue, 5 Oct 2021 16:08:04 +0200 Subject: [PATCH] feedback code wurde in Passwort Vergessen Code eingebettet. --- login/ForgotPW.aspx | 17 +++++++-- login/ForgotPW.aspx.vb | 82 +++++++++++++++++++++++++++++++++++++++++- login/login_FLEX.aspx | 2 +- 3 files changed, 97 insertions(+), 4 deletions(-) diff --git a/login/ForgotPW.aspx b/login/ForgotPW.aspx index bd13a5a..72f0b35 100644 --- a/login/ForgotPW.aspx +++ b/login/ForgotPW.aspx @@ -86,7 +86,12 @@
- + + + + @@ -102,7 +107,15 @@ -->
+ +
- + + + +
+ +
+ + +
diff --git a/login/ForgotPW.aspx.vb b/login/ForgotPW.aspx.vb index 05e1607..f2b5f71 100644 --- a/login/ForgotPW.aspx.vb +++ b/login/ForgotPW.aspx.vb @@ -1,5 +1,85 @@ - +Imports System.Net +Imports System.Net.Mail +Imports System.Drawing +Imports System.Configuration +Imports System.Data.SqlClient + Partial Class login_ForgotPW Inherits System.Web.UI.Page + Protected Sub btn_Back_Click(sender As Object, e As EventArgs) + + Response.Redirect("login/login_FLEX.aspx") + End Sub + + + + Protected Sub SendEmail(sender As Object, e As EventArgs) + Dim username As String = String.Empty + Dim password As String = String.Empty + + ' cDBFunctions.GetNewOpenConnection() + 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 + + ' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString + Using con As New SqlConnection(ConnectionString) + ' Using cmd As New SqlCommand("Validate_User") + Using cmd As New SqlCommand("SELECT COUNT(*) FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password") + ' cmd.CommandType = CommandType.StoredProcedure + + cmd.Connection = con + con.Open() + ' userId = Convert.ToInt32(cmd.ExecuteScalar()) + Dim dr As SqlDataReader = cmd.ExecuteReader() + If dr.Read() Then + username = dr("@Username").ToString() + password = dr("@Password").ToString() + End If + End Using + con.Close() + End Using + + If Not String.IsNullOrEmpty(password) Then + ' SendEmail(username, password) + lblMessage.ForeColor = Color.Green + lblMessage.Text = "Password has been sent to your email address." + Else + lblMessage.ForeColor = Color.Red + lblMessage.Text = "This email address does not match our records." + End If + End Sub + Function SendEmail(username As String, password As String) As Boolean + Dim Msg As New MailMessage + Dim myCredentials As New System.Net.NetworkCredential + myCredentials.UserName = "al@verag.ag" + myCredentials.Password = "Luxandreas#2" + Msg.IsBodyHtml = False + Dim mySmtpsvr As New SmtpClient() + mySmtpsvr.Host = "smtp.1und1.de" 'bei web.de + mySmtpsvr.Port = 587 '25 + mySmtpsvr.UseDefaultCredentials = False + mySmtpsvr.Credentials = myCredentials + Try + Msg.From = New MailAddress("al@verag.ag") + Msg.To.Add("al@verag.ag") + Msg.Subject = "TEST" + Msg.Body = String.Format("Hi {0},

Your password is {1}.

Thank You.", username, password) + + ' Dim attachment As Attachment = New Attachment(File.OpenRead(excel), "Kundenliste.xlsx") + ' Msg.Attachments.Add(attachment) + ' mySmtpsvr.Send(Msg) + MsgBox("SENT") + Return True + Catch ex As Exception + MsgBox(Err.Number & ex.Message & ex.StackTrace.ToString) 'Falls ein Fehler auftritt wird eine MsgBox angezeigt + End Try + Return False + End Function End Class diff --git a/login/login_FLEX.aspx b/login/login_FLEX.aspx index 97d8509..63f55cb 100644 --- a/login/login_FLEX.aspx +++ b/login/login_FLEX.aspx @@ -91,7 +91,7 @@ + -->