protected void btnLogIn_Click(object sender, System.EventArgs e) { // Validation var login = txtLogin.Text.Trim(); var pass = txtPassword.Text.Trim(); bool boolIsSuccessValidation = true; if (string.IsNullOrEmpty(login)) { boolIsSuccessValidation = false; txtLogin.CssClass = "Admin_InvalidTextBox"; // Faild } else { txtLogin.CssClass = "Admin_ValidTextBox"; // OK } if (string.IsNullOrEmpty(pass)) { boolIsSuccessValidation = false; txtPassword.CssClass = "Admin_InvalidTextBox"; // Faild } else { txtPassword.CssClass = "Admin_ValidTextBox"; // OK } if (!validShield.IsValid()) { // Capcha faild boolIsSuccessValidation = false; validShield.TextBoxCss = "Admin_InvalidTextBox"; } if (boolIsSuccessValidation == false) { validShield.TryNew(); MsgErr("Не верно введены данные"); return; } // --------------------------------------------------------------------------- if (Secure.IsDebugAccount(login, pass))//, false)) { Session["isDebug"] = true; Secure.AddUserLog("sa", true, true); Page.Response.Redirect("~/admin/default.aspx"); // Hard coded! return; } // --------------------------------------------------------------------------- var user = CustomerService.GetCustomerByEmailAndPassword(login, pass, false); // --------------------------------------------------------------------------- if (user != null && (user.CustomerRole == Role.Administrator || user.CustomerRole == Role.Moderator)) { AuthorizeService.WriteCookie(user); Page.Response.Redirect("~/admin/default.aspx"); } else { MsgErr(Resources.Resource.Client_Admin_WrongPass); txtPassword.Text = string.Empty; txtLogin.Text = string.Empty; txtLogin.Focus(); validShield.TryNew(); } // --------------------------------------------------------------------------- }