feedback code wurde in Passwort Vergessen Code eingebettet.

This commit is contained in:
ja
2021-10-05 16:08:04 +02:00
parent ef63f43f0a
commit cfcc25c13b
3 changed files with 97 additions and 4 deletions

View File

@@ -86,7 +86,12 @@
<div class="container-fluid" style="width:252px;height:216px;">
<form id="form1" runat="server">
<table cellpadding="0" style="font-family:Arial;font-size:11px;border:1px solid gray">
<tr style=" background-color:#fff; color:#003680; height:30px;font-size:12px">
<tr style="background-color:#fff; color:#003680;height:30px;">
<td>
<asp:Button ID="btn_Back" runat="server" Text="Back" PostBackUrl="~/login/login_FLEX.aspx" OnClick="btn_Back_Click"/>
</td>
</tr>
<tr style="background-color:#fff; color:#003680; height:30px;font-size:12px">
<td align="center" colspan="2" style="color:#fff;font-kerning:auto;font-weight:700;">
<asp:Label ID="lbl_PWvergessen" Text="Haben Sie ihr Passwort vergessen?" runat="server" style=" background-color:#fff; color:#003680; font-size:12px"></asp:Label>
</td></tr>
@@ -102,7 +107,15 @@
<input type="email" runat="server" style="width:150px" placeholder="example@somehost.com" />
</td></tr> -->
<tr><td>
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server"></asp:PasswordRecovery>
<asp:Label ID="lbl_Email" runat="server" Text="Email Address:"></asp:Label>
<asp:TextBox ID="txtEmail" runat="server" Width = "250" />
<br />
<asp:Label ID="lblMessage" runat="server" />
<br />
<asp:Button Text="Send" runat="server" OnClick="SendEmail" />
</td></tr>
</table>

View File

@@ -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},<br /><br />Your password is {1}.<br /><br />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

View File

@@ -91,7 +91,7 @@
<table cellpadding="0" style="font-family:Arial;font-size:11px;border:1px solid gray">
<!-- <tr style=" background-image: linear-gradient(to right, #003680 , #0055cc);color:#fff;height:30px;font-size:12px">
<td align="center" colspan="2" style="color:#fff;font-kerning:auto;font-weight:700;">Bitte melden Sie sich an:</td>
</tr> -->
</tr> -->
<tr style=" background-color:#fff; color:#003680; height:30px;font-size:12px">
<td align="center" colspan="2" style="color:#fff;font-kerning:auto;font-weight:700;">
<asp:Label ID="Label1" runat="server" Text="Login" style="color:#003680;font-size:1.320901320901321vh"></asp:Label></td>