Esempio n. 1
0
        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string         loginUsername = LoginUser.UserName;
            string         loginPassword = LoginUser.Password;
            CaptchaControl CAPTCHA       = LoginUser.FindControl("CAPTCHA") as CaptchaControl;

            // first check the Captcha to insure it is valid.
            if (!CAPTCHA.UserValidated && tries >= 3)
            {
                //CAPTCHA invalid
                LoginUser.FailureText = "The code you entered did not match up with the image provided; please try again with this new image.";
                tries++;
                e.Authenticated = false;
            }

            // next check the userid and password
            else if (Membership.ValidateUser(loginUsername, loginPassword))
            {
                //Only set e.Authenticated to True if ALL checks pass
                e.Authenticated = true;
                tries           = 0;
            }

            // else tell user to try again
            else
            {
                tries++;
                e.Authenticated       = false;
                LoginUser.FailureText = "Your username and/or password are invalid.";
            }
        }
Esempio n. 2
0
        protected void LoginButton_Click1(object sender, EventArgs e)
        {
            defaultOracleInstance = DDRSessionEntity.Current.defaultOracleInstance;
            try
            {
                if (commmanager.ValidateUserAccess(user, Password, defaultOracleInstance))
                {
                    Get_Active_Schema_And_Site(user.ToUpper());

                    Session["userid"] = user.ToUpper().ToString();

                    // Randomly generates a 10-digit secure code and assigns it to the session, so the customer
                    // cannot change their Site or Country in the URL as they're passed from Oracle.
                    var    random          = new Random();
                    string security_string = "";
                    for (int i = 0; i < 10; i++)
                    {
                        security_string = String.Concat(security_string, random.Next(10).ToString());
                    }
                    DDRSessionEntity.Current.SecureSplit = security_string;

                    if ((DDRSessionEntity.Current.can_choose_country == "Y") && (DDRSessionEntity.Current.can_choose_schema == "Y"))
                    {
                        Control myControlMenu = Page.Master.FindControl("NavigationMenu");

                        if (myControlMenu != null)
                        {
                            myControlMenu.Visible = true;
                        }
                        //Response.Redirect("About.aspx");
                        Response.Redirect("DBSchema.aspx");
                    }
                    else if ((DDRSessionEntity.Current.can_choose_country == "Y") && (DDRSessionEntity.Current.can_choose_schema == "N"))
                    {
                        Response.Redirect("About.aspx?dsm=" + DDRSessionEntity.Current.code_schema);
                    }
                    else if ((DDRSessionEntity.Current.can_choose_country == "N") && (DDRSessionEntity.Current.can_choose_schema == "Y"))
                    {
                        //UserEntity.username = user.ToUpper().ToString();
                        Response.Redirect("DBSchema.aspx");
                    }
                    else  // Cannot Choose Country AND Cannot Choose Schema
                    {
                        BindCountrySite();
                        Response.Redirect("~/Default.aspx?name=" + DDRSessionEntity.Current.SiteCode + DDRSessionEntity.Current.SecureSplit + DDRSessionEntity.Current.CountryCode);
                    }
                }
                else
                {
                    ((Label)LoginUser.FindControl("lblnopassworduser")).Visible = true;
                    ((Label)LoginUser.FindControl("lblnopassworduser")).Text    = "Access denied...Please check your database access.";
                }
            }
            catch (Exception ex)
            {
                ((Label)LoginUser.FindControl("lblnopassworduser")).Visible = true;
                ((Label)LoginUser.FindControl("lblnopassworduser")).Text    = ex.Message.ToString();
                //  throw ex;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.RegisterHyperLink.NavigateUrl = "register.aspx?ReturnUrl=" +
                                                 HttpUtility.UrlEncode(this.Request.QueryString["ReturnUrl"]);
            this.RegisterHyperLink.Text = labels.createNow;
            ((PlaceHolder)LoginUser.FindControl("phResetPassword")).Visible = BlogSettings.Instance.EnablePasswordReset;

            if (this.Request.QueryString.ToString() == "logoff")
            {
                FormsAuthentication.SignOut();
                if (this.Request.UrlReferrer != null && this.Request.UrlReferrer != this.Request.Url)
                {
                    this.Response.Redirect(this.Request.UrlReferrer.ToString(), true);
                }
                else
                {
                    this.Response.Redirect("login.aspx");
                }

                return;
            }

            if (!this.Page.IsPostBack || Security.IsAuthenticated)
            {
                return;
            }

            this.Master.SetStatus("warning", "Login failed");
        }
Esempio n. 4
0
        protected void OnClickForUserSignIn(object sender, EventArgs e)
        {
            var userEmail    = LoginUser.FindControl("UserName") as TextBox;
            var userPassword = LoginUser.FindControl("Password") as TextBox;

            if (userEmail != null && userPassword != null)
            {
                var user = PageDataService.GetActiiveUserByUserEmailInAdoNet(userEmail.Text.Trim());
                if (user != null && user.UserPassword.Equals(userPassword.Text))
                {
                    Session[SessionVariables.UserIdInSession] = user.UserId;
                    Response.Redirect("~/Staff/AccountMaintenance.aspx", true);
                }
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["count"]        = null;
            Session["UserID"]       = null;
            Session["page"]         = null;
            Page.Form.DefaultButton = LoginUser.FindControl("LoginButton").UniqueID;

            if (!IsPostBack)

            {
                string year = DateTime.Now.Year.ToString();
                //lblYear.Text = year;

                CheckBox cb       = (CheckBox)LoginUser.FindControl("chkRemember");
                TextBox  username = (TextBox)LoginUser.FindControl("UserName");
                TextBox  password = (TextBox)LoginUser.FindControl("Password");
                if (Request.Cookies["userid"] != null)
                {
                    username.Text = Request.Cookies["userid"].Value;
                }
                else
                {
                    username.Text = "";
                }



                if (Request.Cookies["pwd"] != null)
                {
                    password.Attributes.Add("value", Request.Cookies["pwd"].Value);
                }
                else
                {
                    password.Attributes.Add("value", "");
                }


                if (Request.Cookies["userid"] != null && Request.Cookies["pwd"] != null)
                {
                    cb.Checked = true;
                }
                else
                {
                    cb.Checked = false;
                }
            }
        }
 protected void NextButton_Click(object sender, EventArgs e)
 {
     try{
         DataTable ds = new DataTable();
         ds = clsESPSql.ExecQuery("select * from aspnet_Users where username= '******' or mobilealias='" + tstUserName.Text + "'");
         if (ds.Rows.Count > 0)
         {
             pnlFind.Visible  = false;
             pnlLogin.Visible = true;
             TextBox txtUsername = (TextBox)LoginUser.FindControl("UserName");
             txtUsername.Text = ds.Rows[0]["username"].ToString();
         }
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 7
0
        protected void LoginButton_Click(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection(_Default.GetConnectionString());

            conn.Open();
            Label l = (Label)LoginUser.FindControl("loginFail");

            try
            {
                string user     = ((TextBox)LoginUser.FindControl("UserName")).Text;
                string password = ((TextBox)LoginUser.FindControl("Password")).Text;


                String     passHash = FormsAuthentication.HashPasswordForStoringInConfigFile(password, "SHA1");
                SqlCommand query    = new SqlCommand("select password from Korisnik where userName = @userName", conn);
                query.CommandType = System.Data.CommandType.Text;
                query.Parameters.AddWithValue("@userName", user);
                //query.Parameters.AddWithValue("@password", password);

                string s = (string)query.ExecuteScalar();
                if (string.IsNullOrEmpty(s))
                {
                    Response.Redirect("~\\Account\\Login.aspx");
                }
                else
                {
                    SqlDataReader dr = query.ExecuteReader();
                    dr.Read();
                    if (passHash == dr.GetString(0))
                    {
                        FormsAuthentication.SetAuthCookie(user, true);
                        Response.Redirect("~\\Pocetna.aspx");
                    }
                    else
                    {
                        Response.Redirect("~\\Account\\Login.aspx");
                    }
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                l.Text = ex.Message;
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                HttpContext.Current.Profile.SetPropertyValue("RandomToken", string.Empty);
                HttpContext.Current.Profile.SetPropertyValue("AuthToken", string.Empty);
                Random randomNo = new Random();
                ViewState["LogAttempt"] = 0;
                ViewState["_random"]    = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(randomNo.Next().ToString(), "MD5");
            }
            Button LoginButton = (Button)LoginUser.FindControl("LoginButton");

            LoginButton.Attributes.Add("onclick", "javascript:return md5auth('" + Convert.ToString(ViewState["_random"]) + "');");

            Button ForgotPassword = (Button)LoginUser.FindControl("ForgotPassword");

            ForgotPassword.Attributes.Add("onclick", "javascript:return md5auth('" + Convert.ToString(ViewState["_random"]) + "');");
        }
Esempio n. 9
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Recaptcha

            Button button = (Button)LoginUser.FindControl("LoginButtonReal");
            button.CssClass += " g-recaptcha";
            button.Attributes.Add("data-sitekey", RECAPTCHA_SITE_KEY);
            button.Attributes.Add("data-callback", "ValidateLogin");

            #endregion

            HyperLink linkForgotPassword = (HyperLink)LoginUser.FindControl("linkForgotPassword");
            if (linkForgotPassword != null)
            {
                linkForgotPassword.NavigateUrl = Utils.RelativeWebRoot + "Account/password-retrieval.aspx";
            }

            this.RegisterHyperLink.NavigateUrl = Utils.RelativeWebRoot + "Account/register.aspx?ReturnUrl=" +
                                                 HttpUtility.UrlEncode(this.Request.QueryString["ReturnUrl"]);
            this.RegisterHyperLink.Text = labels.createNow;
            ((PlaceHolder)LoginUser.FindControl("phResetPassword")).Visible = BlogSettings.Instance.EnablePasswordReset;

            if (this.Request.QueryString.ToString() == "logoff")
            {
                Security.SignOut();
                if (this.Request.UrlReferrer != null && this.Request.UrlReferrer != this.Request.Url && this.Request.UrlReferrer.LocalPath.IndexOf("/neet/", StringComparison.OrdinalIgnoreCase) == -1)
                {
                    this.Response.Redirect(this.Request.UrlReferrer.ToString(), true);
                }
                else
                {
                    this.Response.Redirect(BlogEngine.Core.Utils.RelativeWebRoot);
                }

                return;
            }

            if (!this.Page.IsPostBack || Security.IsAuthenticated)
            {
                return;
            }

            this.Master.SetStatus("warning", Resources.labels.loginFailed);
        }
Esempio n. 10
0
        protected void CreateLoginAudit(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e)
        {
            TextBox     txtimgcode1 = (TextBox)LoginUser.FindControl("txtimgcode");
            HiddenField hdnCaptcha  = (HiddenField)LoginUser.FindControl("hdnCaptcha");

            if (txtimgcode1.Text == RemoveSpace(hdnCaptcha.Value.Trim().ToString()))
            {
                TextBox        _Username = (TextBox)LoginUser.FindControl("UserName");
                TextBox        _Password = (TextBox)LoginUser.FindControl("Password");
                MembershipUser user      = Membership.GetUser(_Username.Text);

                if (user != null)
                {
                    string strPassword = string.Empty;
                    OBJloginSchema.UserName = _Username.Text;
                    strPassword             = ObjLoginBL.GetUserPassword(OBJloginSchema);

                    //Added Mahesh Patel on 27-12-2018
                    int ldmDistrictId = 0;
                    ldmDistrictId = ObjLoginBL.GetUserPasswordLDM(OBJloginSchema);

                    if ((CopmpareRandnoPwd(strPassword) == _Password.Text))
                    {
                        string strAuthToken = Guid.NewGuid().ToString();
                        HttpContext.Current.Profile.SetPropertyValue("AuthToken", strAuthToken);
                        Response.Cookies.Add(new HttpCookie("AuthToken", strAuthToken));
                        e.Authenticated           = true;
                        Session["AuthToken"]      = strAuthToken;
                        Session["User"]           = _Username;
                        Session["LDM_DistrictId"] = ldmDistrictId;
                    }
                    else
                    {
                        txtimgcode1.Text = string.Empty;
                    }
                }
            }
            else
            {
                txtimgcode1.Text = string.Empty;
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Message", "alert('Incorrect Captcha Value !! Try again.');", true);
            }
        }
Esempio n. 11
0
        protected void RedirectUser(object sender, EventArgs e)
        {
            TextBox        userName = (TextBox)LoginUser.FindControl("UserName");
            MembershipUser user     = Membership.GetUser(userName.Text);

            Session["UserInRole"] = user.ToString();
            Session["UserRole"]   = Roles.GetRolesForUser(userName.Text)[0].ToLower();

            if (user != null)
            {
                if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "cmsuser")
                {
                    Response.Redirect("~/Admin/MenuManagement/MenuList.aspx");
                }
                else if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "webmaster")
                {
                    Response.Redirect("~/Management/access/users.aspx");
                }
                else if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "admin")
                {
                    Response.Redirect("~/Admin/MenuManagement/MenuList.aspx");
                }
                //Manish 16-11-18
                else if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "ldm")
                {
                    Response.Redirect("~/Admin/MenuManagement/LdmDashboard.aspx");
                    //Response.Redirect("~/Admin/MenuManagement/LDMHome.aspx");
                }
                else if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "rjd")
                {
                    Response.Redirect("~/Site/Home/HomeAdmin.aspx");
                }
                else if (Convert.ToString(Roles.GetRolesForUser(userName.Text)[0]).ToLower() == "ssk")
                {
                    Response.Redirect("~/Site/Home/HomeAdmin.aspx");
                }
                else
                {
                    Response.Redirect("~/Site/Home/Index.aspx");
                }
            }
        }
Esempio n. 12
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            string DepartmentName     = string.Empty;
            Label  lblLoginPnl        = (Label)LoginUser.FindControl("lblLoginPanel");
            Label  lblUserName        = (Label)LoginUser.FindControl("UserNameLabel");
            Label  lblPassword        = (Label)LoginUser.FindControl("PasswordLabel");
            Label  lblRememberMe      = (Label)LoginUser.FindControl("RememberMeLabel");
            Button _btlLogin          = (Button)LoginUser.FindControl("LoginButton");
            Button _btnForgotPassword = (Button)LoginUser.FindControl("ForgotPassword");
            RequiredFieldValidator _UserNameRequired = (RequiredFieldValidator)LoginUser.FindControl("UserNameRequired");
            RequiredFieldValidator _PasswordRequired = (RequiredFieldValidator)LoginUser.FindControl("PasswordRequired");

            if (System.Threading.Thread.CurrentThread.CurrentUICulture.ToString().ToLower() == Convert.ToString("mr-IN").ToLower())
            {
                lblLogin.Text                  = "लॉग इन";
                lblUserName.Text               = "वापरकर्त्याचे नाव";
                lblPassword.Text               = "पासवर्ड";
                lblRememberMe.Text             = "मला लॉगड इन राहु द्या...";
                lblLoginPnl.Text               = "लेखा माहिती";
                _btlLogin.Text                 = "लॉग इन";
                _btnForgotPassword.Text        = "पासवर्ड विसरलात";
                _UserNameRequired.ErrorMessage = "कृपया वापरकर्त्याचे नाव बरोबर लिहावे";
                _PasswordRequired.ErrorMessage = "कृपया पासवर्ड बरोबर लिहावा";
                DepartmentName                 = System.Configuration.ConfigurationManager.AppSettings["DepartmentNameMarathi"].ToString();
                Page.Title = _btlLogin.Text + "-" + DepartmentName;
            }
            else
            {
                lblLogin.Text                  = "Log In";
                lblUserName.Text               = "User Name";
                lblPassword.Text               = "Password";
                lblRememberMe.Text             = "Keep me logged in...";
                lblLoginPnl.Text               = "Account Information";
                _btlLogin.Text                 = "Login";
                _btnForgotPassword.Text        = "Forgot Password";
                _UserNameRequired.ErrorMessage = "User Name is required.";
                _PasswordRequired.ErrorMessage = "Password is required.";
                DepartmentName                 = System.Configuration.ConfigurationManager.AppSettings["DepartmentNameEnglish"].ToString();
                Page.Title = _btlLogin.Text + "-" + DepartmentName;
            }
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user     = ((TextBox)LoginUser.FindControl("UserName")).Text;
            Password = ((TextBox)LoginUser.FindControl("Password")).Text;

            if ((HttpContext.Current.Request.Url.AbsoluteUri.Contains("local")) || // Dev or Local (via GUI)
                (HttpContext.Current.Request.Url.AbsoluteUri.Contains("ddr-d")))
            {
                DDRSessionEntity.Current.defaultOracleInstance = "dev_49";
                DDRSessionEntity.Current.OraclePort            = "credit.d51.lilly.com";
                DDRSessionEntity.Current.OracleServer          = "1525";
            }
            else // Qual or Prod
            {
                DDRSessionEntity.Current.defaultOracleInstance = "prd_49";
                DDRSessionEntity.Current.OraclePort            = "refund.am.lilly.com";
                DDRSessionEntity.Current.OracleServer          = "1526";
            }

            Control myControlMenu    = Page.Master.FindControl("NavigationMenu");
            Control sitemasterupdpnl = Page.Master.FindControl("MainContentPanel");

            //(Panel)sitemasterupdpnl.s
            if (myControlMenu != null)
            {
                myControlMenu.Visible = false;
            }
            ((Label)LoginUser.FindControl("lblnopassworduser")).Visible = false;

            if (!IsPostBack)
            {
                Label mylabelControl = (Label)Page.Master.FindControl("lbluserid");
                mylabelControl.Text = "Not Set";
                Label lblsitecode = (Label)Page.Master.FindControl("lblsitecode");
                lblsitecode.Text = "Not Set";

                Session["userid"] = "Not Set";
                DDRSessionEntity.Current.SiteCode = "Not Set";
            }
        }
Esempio n. 14
0
        /// <summary>
        /// The login user_ on logged in.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void LoginUser_OnLoggedIn(object sender, EventArgs e)
        {
            // не можем получить текущего юзера из контекста внутри сервиса т.к. контекст еще не обновит внутри данные, только в следующий запрос
            var textBox = LoginUser.FindControl("UserName") as TextBox;

            if (textBox != null)
            {
                var userName    = textBox.Text;
                var currentUser = service.GetUserByName(userName);

                // если что либо из списка ниже не в онлайне и пользователь не админ и не админские права, то выдаём страницу что сайт на тех обслуживании
                var pvp = currentUser.PointDistributionPolicy();
                if (pvp != null && (!pvp.IsOnLine || !pvp.Parent.IsOnLine || !pvp.Parent.Parent.IsOnLine) &&
                    !service.IsUserHasAdminPermissions(currentUser))
                {
                    RedirectUtils.RedirectToTechnical(Response);
                }
                else
                {
                    Response.Redirect("~/Pages/Main.aspx");
                }
            }
        }
Esempio n. 15
0
        protected void LoginUser_ForgotPassword(object sender, EventArgs e)
        {
            TextBox userName = (TextBox)LoginUser.FindControl("UserName");

            if (userName.Text == string.Empty)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Message", "alert('Please enter user name ');", true);
                return;
            }
            MembershipUser user = Membership.GetUser(userName.Text);

            if (user != null)
            {
                string t_Passsword;
                string t_username;

                t_Passsword = user.ResetPassword();
                t_username  = userName.Text;


                OBJloginSchema.UserName = userName.Text.Trim();
                OBJloginSchema.Password = EncryptMD5(t_Passsword);

                ObjLoginBL.LoginUser_ForgotPassword(OBJloginSchema);

                //MahaITLDBAccess = new BL.BL(System.Configuration.ConfigurationManager.AppSettings["APPID"].ToString());
                ObjLoginBL.SendEmailuser("forgotpassword_user", "", Membership.GetUser(userName.Text).Email.ToString(), "", t_Passsword, t_username);

                Label t_PasswordSent = (Label)LoginUser.FindControl("PasswordSent");
                t_PasswordSent.Text = "Password Sent to Registered Mail address"; //GetResourceValue("General", "lblPasswordSent", "Password Sent to Registered Mail address");
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "Message", "alert('Invalid UserName');", true);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            HyperLink linkForgotPassword = (HyperLink)LoginUser.FindControl("linkForgotPassword");

            if (linkForgotPassword != null)
            {
                linkForgotPassword.NavigateUrl = Utils.RelativeWebRoot + "Account/password-retrieval.aspx";
            }

            this.RegisterHyperLink.NavigateUrl = Utils.RelativeWebRoot + "Account/register.aspx?ReturnUrl=" +
                                                 HttpUtility.UrlEncode(this.Request.QueryString["ReturnUrl"]);
            this.RegisterHyperLink.Text = labels.createNow;
            ((PlaceHolder)LoginUser.FindControl("phResetPassword")).Visible = BlogSettings.Instance.EnablePasswordReset;

            if (this.Request.QueryString.ToString() == "logoff")
            {
                Security.SignOut();
                if (this.Request.UrlReferrer != null && this.Request.UrlReferrer != this.Request.Url && this.Request.UrlReferrer.LocalPath.IndexOf("/admin/", StringComparison.OrdinalIgnoreCase) == -1)
                {
                    this.Response.Redirect(this.Request.UrlReferrer.ToString(), true);
                }
                else
                {
                    this.Response.Redirect(BlogEngine.Core.Utils.AbsoluteWebRoot.ToString());
                }

                return;
            }

            if (!this.Page.IsPostBack || Security.IsAuthenticated)
            {
                return;
            }

            this.Master.SetStatus("warning", Resources.labels.loginFailed);
        }
Esempio n. 17
0
        public void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            //verify what was in username box to data set
            TextBox username = (TextBox)LoginUser.FindControl("UserName");
            string  uName    = username.Text;
            TextBox password = (TextBox)LoginUser.FindControl("Password");
            string  pWord    = password.Text;
            TextBox compID   = (TextBox)LoginUser.FindControl("CompanyID");
            string  cID      = compID.Text;

            Session["uName"] = uName;
            Session["pWord"] = pWord;
            Session["cID"]   = cID;


            if (SOURCE.User.Login(uName, pWord, cID))
            {
                e.Authenticated = true;
            }
            else
            {
                e.Authenticated = false;
            }
        }
Esempio n. 18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.Form.DefaultButton = ((Button)LoginUser.FindControl("LoginButton")).UniqueID;
 }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var txtEmail = LoginUser.FindControl("UserName");

            txtEmail.Focus();
        }
Esempio n. 20
0
 protected Label getBranchLabel()
 {
     return((System.Web.UI.WebControls.Label)LoginUser.FindControl("BranchLabel"));
 }
Esempio n. 21
0
 protected DropDownList getBranch()
 {
     return((System.Web.UI.WebControls.DropDownList)LoginUser.FindControl("Branch"));
 }
Esempio n. 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CaptchaControl CAPTCHA = LoginUser.FindControl("CAPTCHA") as CaptchaControl;

            CAPTCHA.Visible = tries >= 3;
        }
Esempio n. 23
0
        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} authenticate starting");
            LoginUser.FailureText = "Данный логин/пароль не найден";
            HttpContext.Current.Session["BranchId"]    = null;
            HttpContext.Current.Session["UserActions"] = null;
            if (LoginUser.UserName == superusername && LoginUser.Password == superusername.ToLower())
            {
                e.Authenticated = true;
                OstCard.Data.Database.Log(sc.UserGuid(superusername), "Вход в систему", null);
                WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} authenticate success");
                return;
            }
            else
            {
                WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} validation starting ");
                bool auth = System.Web.Security.Membership.ValidateUser(LoginUser.UserName, LoginUser.Password);
                if (auth == true)
                {
                    WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} validation success");
                    WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} branch choosing");
                    // Проверяем на Казанский филиал и может ли он логинится в любой филиал
                    int branchId     = sc.BranchId(LoginUser.UserName);
                    int branchIdMain = BranchStore.getBranchMainFilial(branchId, false);

                    string   abu             = System.Configuration.ConfigurationManager.AppSettings["AllBranchsUser"];
                    string[] allbranchsusers = abu?.Split(',');

                    ArrayList al = new ArrayList();
                    DataSet   ds = new DataSet();

                    if (allbranchsusers.Contains(LoginUser.UserName))
                    {
                        lock (OstCard.Data.Database.lockObjectDB)
                        {
                            OstCard.Data.Database.ExecuteQuery("select id, department from branchs order by department", ref ds, null);
                            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                            {
                                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                {
                                    BranchStore branchItem = new BranchStore(Convert.ToInt32(ds.Tables[0].Rows[i]["id"]), "", ds.Tables[0].Rows[i]["department"].ToString());
                                    if (branchItem.id == branchId)
                                    {
                                        branchItem.ident_dep = "select";
                                    }
                                    al.Add(branchItem);
                                }
                            }
                        }
                    }
                    else
                    {
                        //if (branchId == 106) // Казанский филиал - можно выбрать все подчиненные
                        if (branchIdMain > 0)
                        {
                            lock (OstCard.Data.Database.lockObjectDB)
                            {
                                //OstCard.Data.Database.ExecuteQuery("select id, department from branchs where id=106 or id_parent=106 order by id", ref ds, null);
                                OstCard.Data.Database.ExecuteQuery(string.Format("select id, department from branchs where id={0} or id_parent={0} order by id", branchIdMain), ref ds, null);
                                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                {
                                    //if (branchId == 106)
                                    if (branchId == branchIdMain)
                                    {
                                        BranchStore branchItem = new BranchStore(-1, "", "Выберите филиал");
                                        branchItem.ident_dep = "select";
                                        al.Add(branchItem);
                                    }
                                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                    {
                                        BranchStore branchItem = new BranchStore(Convert.ToInt32(ds.Tables[0].Rows[i]["id"]), "", ds.Tables[0].Rows[i]["department"].ToString());
                                        //if (branchItem.id == branchId && branchId!=106) branchItem.ident_dep = "select";
                                        if (branchItem.id == branchId && branchId != branchIdMain)
                                        {
                                            branchItem.ident_dep = "select";
                                        }
                                        al.Add(branchItem);
                                    }
                                }
                            }
                        }
                        else // Ищем подчиненные Казанского филиала
                        {
                            lock (OstCard.Data.Database.lockObjectDB)
                            {
                                //OstCard.Data.Database.ExecuteQuery("select id, department from branchs where id_parent=106 and id=" + branchId, ref ds, null);
                                OstCard.Data.Database.ExecuteQuery("select id, department from branchs where id_parent=" + branchIdMain + " and id=" + branchId, ref ds, null);
                                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                {
                                    //OstCard.Data.Database.ExecuteQuery("select id, department from branchs where id_parent=106 order by id", ref ds, null);
                                    OstCard.Data.Database.ExecuteQuery("select id, department from branchs where id_parent=" + branchIdMain + " order by id", ref ds, null);
                                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                                    {
                                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                        {
                                            BranchStore branchItem = new BranchStore(Convert.ToInt32(ds.Tables[0].Rows[i]["id"]), "", ds.Tables[0].Rows[i]["department"].ToString());
                                            if (branchItem.id == branchId)
                                            {
                                                branchItem.ident_dep = "select";
                                            }
                                            al.Add(branchItem);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    DropDownList dList = getBranch();
                    if (dList.Items.Count > 1 && dList.SelectedIndex >= 0)
                    {
                        if (Convert.ToInt32(dList.Items[dList.SelectedIndex].Value) > 0)
                        {
                            HttpContext.Current.Session["BranchId"]        = dList.Items[dList.SelectedIndex].Value;
                            HttpContext.Current.Session["CurrentUserName"] = LoginUser.UserName.ToLower();
                            HttpContext.Current.Session["CurrentUserId"]   = sc.UserId(LoginUser.UserName);
                        }
                        else
                        {
                            dList.Items.Clear();
                        }
                    }

                    if (dList.Items.Count < 1 && al.Count > 0 && dList.SelectedIndex < 0)
                    {
                        for (int i = 0; i < al.Count; i++)
                        {
                            BranchStore b = (BranchStore)al[i];
                            dList.Items.Add(new ListItem(b.department, b.id.ToString()));
                            if (b.ident_dep == "select")
                            {
                                dList.SelectedIndex = i;
                            }
                        }
                        getBranchLabel().Visible = true;
                        getBranch().Visible      = true;
                        auth = false;
                        LoginUser.FailureText = "Необходимо указать подразделение";
                        String id_pasword      = LoginUser.FindControl("Password").ClientID;
                        String id_paswordLabel = LoginUser.FindControl("PasswordLabel").ClientID;
                        String id_branch       = LoginUser.FindControl("Branch").ClientID;
                        ClientScript.RegisterClientScriptBlock(GetType(), "focus42",
                                                               "<script type='text/javascript'>$(document).ready(function(){ " +
                                                               "$('#" + id_pasword + "').val('" + LoginUser.Password + "');" +
                                                               "$('#" + id_branch + "').focus();" +
                                                               //"$('#" + id_paswordLabel + "').css('display','none');" +
                                                               //"$('#" + id_pasword + "').css('display','none');" +
                                                               //"$('#" + id_pasword + "').attr('disabled', true);" +
                                                               "});</script>");
                    }
                }
                else
                {
                    WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} validation failed");
                    getBranchLabel().Visible = false;
                    getBranch().Visible      = false;
                }
                WebLog.LogClass.WriteToLog($"{sessionId} Login {LoginUser.UserName} authenticate result {auth}");
                e.Authenticated = auth;
            }
        }
Esempio n. 24
0
        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (Membership.ValidateUser(LoginUser.UserName, LoginUser.Password))
            {
                string      userId      = Membership.GetUser(LoginUser.UserName).UserName;
                UserProfile userProfile = DALHelper.GetUsers(userCriteria => userCriteria.UserName.ToLower() == userId.ToLower()).FirstOrDefault();
                if (userId != null)
                {
                    Session["UserID"]   = userProfile.ID;
                    Session["UserName"] = userProfile.UserName;
                    Session["Name"]     = userProfile.FirstName + " " + userProfile.LastName;

                    DataTable dtUserStatus = ObjclsFrms.loadList("SelNewUserStatus", "sp_Masters", Session["UserID"].ToString());
                    if (dtUserStatus.Rows.Count == 0)
                    {
                        Response.Redirect("ActivateAccount.aspx");
                    }
                    else
                    {
                        CheckBox cb = (CheckBox)LoginUser.FindControl("chkRemember");
                        if (cb.Checked)
                        {
                            Response.Cookies["userid"].Value   = LoginUser.UserName;
                            Response.Cookies["pwd"].Value      = LoginUser.Password;
                            Response.Cookies["userid"].Expires = DateTime.Now.AddDays(15);
                            Response.Cookies["pwd"].Expires    = DateTime.Now.AddDays(15);
                        }
                        else
                        {
                            Response.Cookies["userid"].Value   = "";
                            Response.Cookies["pwd"].Value      = "";
                            Response.Cookies["userid"].Expires = DateTime.Now.AddDays(-1);
                            Response.Cookies["pwd"].Expires    = DateTime.Now.AddDays(-1);
                        }

                        LoginAudit(userProfile.ID.ToString(), LoginUser.UserName, "Success");
                        e.Authenticated = true;
                        var userRoles = Roles.GetRolesForUser(Session["UserName"].ToString());

                        //DataTable dtMarket = ObjclsFrms.loadList("SelectUserMarket", "sp_Masters", Session["UserID"].ToString());
                        //if (dtMarket.Rows.Count > 0)
                        //{
                        //    Session["Mar_ID"] = dtMarket.Rows[0]["dst_mar_ID"].ToString(); //"2";
                        //}
                        //else
                        //{
                        //    Session["Mar_ID"] = "0";
                        //}
                        //string v = "";
                        //if (Request.Params.Count > 0)
                        //{
                        //    try
                        //    {

                        //        if (Request.Params["mode"] != null && Request.Params["mode"].ToString().Equals("0"))
                        //        {
                        //            v = "1";
                        //        }
                        //        else if (Request.Params["mode"].ToString().Equals("2"))
                        //        {
                        //            v = "2";
                        //        }
                        //    }
                        //    catch (Exception ex)
                        //    {
                        //        v = "0";
                        //    }

                        //}
                        //else
                        //{
                        //    v = "0";
                        //}
                        //if (v == "0")
                        //{
                        Response.Redirect("Admin/AdminDashboard.aspx");
                        //    //Response.Redirect("Admin/ViewClaim.aspx?Id=560");
                        //}
                        //else if (v == "2") { Response.Redirect("Admin/ListNewClaim.aspx"); }
                        //else if (v == "1") { Response.Redirect("Admin/DisplayClaim.aspx?id=" + Request.Params["id"].ToString()); }

                        //return;
                    }
                }
            }
            else
            {
                e.Authenticated = false;
                LoginAudit("", LoginUser.UserName, "Failure");
            }
        }