Fix email wird nicht erkannt forgotpw.aspx

This commit is contained in:
ja
2021-10-20 15:40:53 +02:00
parent c300dd1918
commit ec1cf07188
4 changed files with 56 additions and 83 deletions

View File

@@ -322,7 +322,7 @@
<tr style="color:#003680; height:40px;">
<td align="left" colspan="2">
<asp:TextBox ID="txtEmail_M" runat="server" Width="325px" ValidationGroup="Valtxtemail_M" Font-Size="2.025em" Placeholder="E-Mail" CssClass="bg-email-icon" style="margin-left:25px;color:#003680;margin-bottom:60px"/>
<asp:RequiredFieldValidator ID="valreqtxtEmail_M" ControlToValidate="txtEmail" ValidationGroup="Valtxtemail_M" runat="server" Text="Require E-Mail Address" ></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="valreqtxtEmail_M" ControlToValidate="txtEmail_M" ValidationGroup="Valtxtemail_M" runat="server" Text="Require E-Mail Address" ></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ControlToValidate="txtEmail_M" ForeColor="Red" Font-Size="24px" runat="server" ID="regexval_txt_Email_M" ValidationGroup="val-mobil" ValidationExpression="[\w\.]+\@(\bverag.ag\b)" Display="Dynamic" ErrorMessage="The E-Mail has not the correct domain!" SetFocusOnError="true"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ControlToValidate="txtEmail_M" ForeColor="Red" Font-Size="24px" runat="server" ID="regexval_2_txt_Email_M" ValidationGroup="val-mobil" ValidationExpression="[\w\.]+\@[\w]+(?:\.[\w]{3}|\.[\w]{2}\.[\w]{2}|\.[\w]{2})\b" Display="Dynamic" ErrorMessage="The E-Mail has not the correct domain!" SetFocusOnError="true"></asp:RegularExpressionValidator>
</td></tr>

View File

@@ -137,58 +137,22 @@ Partial Class ForgotPW
valid_getNumber_M_Input.Enabled = True
valreqtxtEmail_M.Validate()
If valreqtxtEmail_M.IsValid = True Then
Boolemail_mobile_notempty = True
Boolemail_desktop_notempty = False
If Boolemail_mobile_notempty = True Then
regexval_2_txt_Email_M.Validate()
Boolemail_mobile_regexdomain = True
Boolemail_desktop_regexdomain = False
If Boolemail_mobile_regexdomain = True Then
regexval_2_txt_Email_M.Validate()
If regexval_2_txt_Email_M.IsValid = True Then
Boolemail_mobile_regex = True
Boolemail_desktop_regex = False
If Boolemail_mobile_notempty = True AndAlso Boolemail_mobile_regexdomain = True AndAlso Boolemail_mobile_regex = True Then
email = txtEmail_M.Text
Else
regexval_txt_Email_M.IsValid = True
Boolemail_mobile_regex = True
Boolemail_desktop_regex = False
If Boolemail_mobile_regexdomain = True Then
email = txtEmail_M.Text
End If
End If
End If
ElseIf valreqtxtEmail_M.IsValid = False Then
Boolemail_mobile_regexdomain = False
valreqtxtEmail.ErrorMessage = "Annotation: The given Domain is not the company domain."
regexval_txt_Email_M.Validate()
If regexval_txt_Email_M.IsValid = False Then
regexval_txt_Email_M.ErrorMessage = "Annotation: The Domain does not match."
regexval_txt_Email.Validate()
Boolemail_mobile_regex = True
If Boolemail_mobile_regex = True AndAlso Boolemail_mobile_regexdomain = False Then
regexval_txt_Email_2.IsValid = True
If regexval_2_txt_Email_M.IsValid = True Then
email = txtEmail_M.Text
End If
Else
regexval_txt_Email.Validate()
If regexval_2_txt_Email_M.IsValid = True Then
email = txtEmail_M.Text
End If
End If
End If
End If
valreqtxtusername_M.Validate()
If valreqtxtusername_M.IsValid = True Then
Booluser_mobile_notempty = True
Booluser_desktop_notempty = False
check_UserName_regex_M.Validate()
If check_UserName_regex_M.IsValid = False Then
check_UserName_regex_M.ErrorMessage = "Annotation: The Username does not match the requirements."
Else
Booluser_desktop_regex = False
Booluser_mobile_regex = True
check_UserName_regex_M.Validate()
If check_UserName_regex_M.IsValid = True AndAlso Booluser_mobile_regex = True AndAlso Booluser_desktop_regex = False Then
username = txt_Username_M.Text
End If
End If
End If
CustomerID_M_required.Validate()
If CustomerID_M_required.IsValid = True Then
valid_getNumber_M_Input.Validate()
@@ -234,7 +198,8 @@ Partial Class ForgotPW
username = dr("Username").ToString()
password = dr("Password").ToString()
email = dr("Email").ToString()
customerID = VERAG_PROG_ALLGEMEIN.cCryptography2.Encrypt(dr("KundenNr").ToString())
customerID = dr("UserId").ToString()
Try
If txt_Username.Text = dr("Username").ToString() AndAlso String.IsNullOrEmpty(txt_Username_M.Text) = True And String.IsNullOrEmpty(customerID) = False Then
username = txt_Username.Text

View File

@@ -270,12 +270,11 @@
<div id="content_container">
<div class="container-fluid">
<form id="form1" runat="server">
<asp:Login ID = "Login1" runat = "server" OnAuthenticate= "ValidateUser" DestinationPageUrl="../Customers/CustomsAviso.aspx" >
<LayoutTemplate>
<center>
<!-- Große Bildschirme-->
<div class="d-none d-md-block">
<asp:Login ID = "Login1" runat = "server" OnAuthenticate= "ValidateUser" DestinationPageUrl="../Customers/CustomsAviso.aspx" >
<LayoutTemplate>
<center>
<table id="tbl_main" cellpadding="0" style="margin: 22px 0px 6px 6px; border:none">
<tr style="color:#003680; height:30px;">
<td align="left" style="color:#fff;font-kerning:auto;">
@@ -321,9 +320,15 @@
</td>
</tr>
</table>
</center>
</LayoutTemplate>
</asp:Login>
</div>
<!--Smartphone-Bildschirme-->
<div class="d-md-none">
<asp:Login ID = "Login2" runat = "server" OnAuthenticate= "ValidateUser" DestinationPageUrl="../Customers/CustomsAviso.aspx" >
<LayoutTemplate>
<center>
<table id="tbl_main_M" cellpadding="0" style="margin: 4px 0px 4px 4px;border:none">
<tr style="color:#003680; height:30px;">
<td align="left" style="color:#fff;font-kerning:auto;">
@@ -339,15 +344,15 @@
</tr>
<tr style="color:#003680; height:86px;">
<td align="left" colspan="2">
<asp:TextBox id="UserName_M" runat="server" CssClass="bg-user-icon" TextMode="SingleLine" Width = "325" ValidationGroup="Login_M" Placeholder="Username" required="true" Font-Size="2.025em" style="margin-left:22px;color:#003680"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserName_M_required" runat="server" ControlToValidate="UserName_M" ErrorMessage="Please enter the Username." ForeColor="Red" style="margin-left:22px;font-size:19px" ToolTip="The Username is required." ValidationGroup="Login_M"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="check_UserName_M_regex" ControlToValidate="UserName_M" ValidationGroup="Login_M" ForeColor="Red" runat="server" style="margin-left:132px;color:red" Display="Dynamic" SetFocusOnError="true" ValidationExpression="^([a-zA-Z1-9]{4,30})$" ErrorMessage="Username does not meet the requirements." ></asp:RegularExpressionValidator>
<asp:TextBox id="Username" runat="server" CssClass="bg-user-icon" TextMode="SingleLine" Width = "325" ValidationGroup="Login_M" Placeholder="Username" required="true" Font-Size="2.025em" style="margin-left:22px;color:#003680"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserName_M_required" runat="server" ControlToValidate="Username" ErrorMessage="Please enter the Username." ForeColor="Red" style="margin-left:22px;font-size:19px" ToolTip="The Username is required." ValidationGroup="Login_M"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="check_UserName_M_regex" ControlToValidate="Username" ValidationGroup="Login_M" ForeColor="Red" runat="server" style="margin-left:132px;color:red" Display="Dynamic" SetFocusOnError="true" ValidationExpression="^([a-zA-Z1-9]{4,30})$" ErrorMessage="Username does not meet the requirements." ></asp:RegularExpressionValidator>
</td>
</tr>
<tr style="color:#003680; height:86px;">
<td align="left" colspan="2">
<asp:TextBox ID="Password_M" runat="server" CssClass="bg-key-icon" TextMode="Password" required="true" Width = "325" Font-Size="2.025em" ValidationGroup="Login_M" MaxLength="30" AutoCompleteType="Enabled" CausesValidation="true" style="margin-left:22px;color:#003680" Placeholder="Password" Text="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="Passwordrequired_M" runat="server" ControlToValidate="Password_M" style="margin-left:22px;color:red;" ErrorMessage="Password is needed to authenticate." ToolTip="Please enter the Password." ValidationGroup="Login_M"></asp:RequiredFieldValidator>
<asp:TextBox ID="Password" runat="server" CssClass="bg-key-icon" TextMode="Password" required="true" Width = "325" Font-Size="2.025em" ValidationGroup="Login_M" MaxLength="30" AutoCompleteType="Enabled" CausesValidation="true" style="margin-left:22px;color:#003680" Placeholder="Password" Text="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="Passwordrequired_M" runat="server" ControlToValidate="Password" style="margin-left:22px;color:red;" ErrorMessage="Password is needed to authenticate." ToolTip="Please enter the Password." ValidationGroup="Login_M"></asp:RequiredFieldValidator>
</td>
</tr>
<tr style="color:#003680; height:143px;">
@@ -371,8 +376,8 @@
</table>
</div>
</center>
</LayoutTemplate>
</asp:Login>
</LayoutTemplate></asp:Login>
</div>
</form>
</div>
</div>

View File

@@ -19,23 +19,23 @@ Partial Class login_FLEX
End If
Dim tb As TextBox = Login1.FindControl("txt_CustomerID")
Dim tb_M As TextBox = Login1.FindControl("txt_CustomerID_M")
Dim tb2 As TextBox = Login1.FindControl("UserName")
Dim tb2_M As TextBox = Login1.FindControl("UserName_M")
Dim tb_M As TextBox = Login2.FindControl("txt_CustomerID_M")
Dim tb2 As TextBox = Login1.FindControl("Username")
Dim tb2_M As TextBox = Login2.FindControl("Username")
Dim tb3 As TextBox = Login1.FindControl("Password")
Dim tb3_M As TextBox = Login1.FindControl("Password_M")
Dim tb3_M As TextBox = Login2.FindControl("Password")
Dim reqfieldvaluserID As RequiredFieldValidator = Login1.FindControl("CustomerIDrequired")
Dim reqfieldvaluserID_M As RequiredFieldValidator = Login1.FindControl("CustomerID_M_required")
Dim reqfieldvaluserID_M As RequiredFieldValidator = Login2.FindControl("CustomerID_M_required")
Dim reqfieldvaluserName As RequiredFieldValidator = Login1.FindControl("UserNamerequired")
Dim reqfieldvaluserName_M As RequiredFieldValidator = Login1.FindControl("UserName_M_required")
Dim reqfieldvaluserName_M As RequiredFieldValidator = Login2.FindControl("UserName_M_required")
Dim reqfieldvalpassw As RequiredFieldValidator = Login1.FindControl("Passwordrequired")
Dim reqfieldvalpassw_M As RequiredFieldValidator = Login1.FindControl("Passwordrequired_M")
Dim reqfieldvalpassw_M As RequiredFieldValidator = Login2.FindControl("Passwordrequired_M")
Dim regexuserID As RegularExpressionValidator = Login1.FindControl("valid_getNumberInput")
Dim regexuserID_M As RegularExpressionValidator = Login1.FindControl("valid_getNumber_M_Input")
Dim regexuserID_M As RegularExpressionValidator = Login2.FindControl("valid_getNumber_M_Input")
Dim regexusername As RegularExpressionValidator = Login1.FindControl("check_UserName_regex")
Dim regexusername_M As RegularExpressionValidator = Login1.FindControl("check_UserName_M_regex")
Dim regexusername_M As RegularExpressionValidator = Login2.FindControl("check_UserName_M_regex")
Dim Customer_ID As String = String.Empty
Dim UserNaMe As String = String.Empty
@@ -115,10 +115,10 @@ Partial Class login_FLEX
' 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(*), UserId,Username, Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password AND Kundennr=@Kundennr")
Using cmd As New SqlCommand("SELECT UserId,Username, Password FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Password=@Password AND UserId=@KundenNr")
' cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Username", UserNaMe)
cmd.Parameters.AddWithValue("UserID", Customer_ID)
cmd.Parameters.AddWithValue("@KundenNr", Customer_ID)
cmd.Parameters.AddWithValue("@Password", passw)
cmd.Connection = con
con.Open()
@@ -166,6 +166,9 @@ Partial Class login_FLEX
con.Close()
End Using
End Using
MsgBox("Wow1")
Page.Response.Redirect("../Customers/CustomsAviso.aspx")
End Sub
Protected Sub LoginButton_Click(sender As Object, e As EventArgs)