diff --git a/Global.asax b/Global.asax index 0dc5ae7..4be1c04 100644 --- a/Global.asax +++ b/Global.asax @@ -2,41 +2,43 @@ diff --git a/Web.config b/Web.config index 67a4d1d..e63ef32 100644 --- a/Web.config +++ b/Web.config @@ -123,5 +123,15 @@ + + + + + + + + - \ No newline at end of file + + + diff --git a/login/login_FLEX.aspx.vb b/login/login_FLEX.aspx.vb index 2b57d1e..3e66034 100644 --- a/login/login_FLEX.aspx.vb +++ b/login/login_FLEX.aspx.vb @@ -5,10 +5,11 @@ Partial Class login_FLEX Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As EventArgs) If Me.Page.User.Identity.IsAuthenticated Then - Response.Redirect("../Customers/Welcome.aspx") + Response.Redirect("../Customers/Welcome.aspx", False) End If If Not Me.Page.User.Identity.IsAuthenticated Then FormsAuthentication.RedirectToLoginPage() + Response.End() End If End Sub Protected Sub ValidateUser(sender As Object, e As EventArgs) @@ -43,6 +44,8 @@ Partial Class login_FLEX 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 = Login2.FindControl("check_UserName_M_regex") + Dim cb As CheckBox = Login1.FindControl("RememberMe") + Dim cb_M As CheckBox = Login2.FindControl("RememberMe_M") Dim Customer_ID As String = String.Empty Dim UserNaMe As String = String.Empty @@ -81,7 +84,7 @@ Partial Class login_FLEX If regexusername.IsValid Then UserNaMe = tb2.Text Else - regexusername_M.ErrorMessage = "Username doeas not have any special chaaracters in it." + regexusername_M.ErrorMessage = "Username does not have any special chaaracters in it." End If Else reqfieldvaluserName.ErrorMessage = "Username has to be given." @@ -99,31 +102,24 @@ Partial Class login_FLEX regexusername.ErrorMessage = "Password has to match the criterias of tge info button." End If End If - If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then - reqfieldvalpassw.Enabled = True - reqfieldvalpassw_M.Enabled = False - - reqfieldvalpassw.Validate() - If reqfieldvalpassw.IsValid = True Then - End If - passw = tb3.Text - End If - If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then - reqfieldvalpassw.Enabled = True - reqfieldvalpassw_M.Enabled = False - - reqfieldvalpassw.Validate() - If reqfieldvalpassw.IsValid = True Then - End If - passw = tb3_M.Text - End If End If If String.IsNullOrEmpty(tb3.Text) = False AndAlso String.IsNullOrEmpty(tb3_M.Text) = True Then + reqfieldvalpassw.Enabled = True + reqfieldvalpassw_M.Enabled = False + reqfieldvalpassw.Validate() + If reqfieldvalpassw.IsValid = True Then + passw = tb3.Text + End If + End If + If String.IsNullOrEmpty(tb3_M.Text) = False AndAlso String.IsNullOrEmpty(tb3.Text) = True Then reqfieldvalpassw.Enabled = False reqfieldvalpassw_M.Enabled = True + reqfieldvalpassw_M.Validate() If reqfieldvalpassw_M.IsValid = True Then passw = tb3_M.Text + Else + reqfieldvalpassw_M.ErrorMessage = "Please insert your personal passowrd." End If End If ' Dim constr As String = ConfigurationManager.ConnectionStrings("constr").ConnectionString @@ -169,7 +165,7 @@ Partial Class login_FLEX Session.Add("test", UserNaMe) Session.Add("UserID", Customer_ID) Session.Add("PW", passw) - FormsAuthentication.RedirectFromLoginPage(UserNaMe, True) + 'FormsAuthentication.SetAuthCookie(Login1.UserName, True) 'Response.Redirect("../Customers/CustomsAviso.aspx") @@ -180,41 +176,18 @@ Partial Class login_FLEX con.Close() End Using End Using - MsgBox("Wow1" + Environment.NewLine + Customer_ID + Environment.NewLine + UserNaMe + Environment.NewLine + passw) - Page.Response.Redirect("../Customers/CustomsAviso.aspx") - + If String.IsNullOrEmpty(tb2_M.Text) = False AndAlso String.IsNullOrEmpty(tb2.Text) = True Then + FormsAuthentication.SetAuthCookie(Login1.UserName, cb_M.Checked) + ElseIf String.IsNullOrEmpty(tb2.Text) = False AndAlso String.IsNullOrEmpty(tb2_M.Text) = True Then + FormsAuthentication.SetAuthCookie(Login2.UserName, cb.Checked) + End If + FormsAuthentication.RedirectFromLoginPage(UserNaMe, True) End Sub Protected Sub LoginButton_Click(sender As Object, e As EventArgs) Validate("Login") - If Page.IsValid() Then - MsgBox("Wow1") - Dim cb As CheckBox = Page.FindControl("RememberMe") - If cb.Checked = True Then - FormsAuthentication.SetAuthCookie(Login1.UserName, True) - Else - FormsAuthentication.SetAuthCookie(Login1.UserName, False) - End If - Response.Redirect("../Customers/CustomsAviso.aspx") - Else - MsgBox("Error1") - Response.Redirect("login_FLEX.aspx") - End If End Sub Protected Sub LoginButton_M_Click(sender As Object, e As EventArgs) Validate("Login_M") - If Page.IsValid() Then - MsgBox("Wow2") - Dim cb As CheckBox = Page.FindControl("RememberMe_M") - If cb.Checked = True Then - FormsAuthentication.SetAuthCookie(Login1.UserName, True) - Else - FormsAuthentication.SetAuthCookie(Login1.UserName, False) - End If - Response.Redirect("../Customers/CustomsAviso.aspx") - Else - MsgBox("Error2") - Response.Redirect("login_FLEX.aspx") - End If End Sub End Class