Exemple #1
0
        public static bool SaveChangePass(string Zold, string Znew)
        {
            string UserName = HttpContext.Current.Session["UserName"].ToString();

            try
            {
                string[] nResult = Users_Data.CheckUser(UserName, Zold);
                if (nResult[0] == "ERR")
                {
                    return(false);
                }
                else
                {
                    Users_Data.UpdatePass(nResult[1], MyCryptography.HashPass(Znew));
                    return(true);
                }
            }
            catch { return(false); }
        }
Exemple #2
0
        public static string[] CheckUser(string UserName, string Pass)
        {
            string[]  nResult    = new string[3];
            User_Info nUserLogin = new User_Info(UserName, true);

            if (nUserLogin.Key.Trim().Length == 0)
            {
                nResult[0] = "ERR";
                nResult[1] = "CheckUser_Error01";
                return(nResult);//"Don't have this UserName";
            }

            if (nUserLogin.Password != MyCryptography.HashPass(Pass))
            {
                nUserLogin.UpdateFailedPass();
                nResult[0] = "ERR";
                nResult[1] = "CheckUser_Error01";
                return(nResult);// "Wrong Password";
            }

            if (!nUserLogin.Activate)
            {
                nResult[0] = "ERR";
                nResult[1] = "CheckUser_Error02";
                return(nResult);//"Don't Activate"
            }

            if (nUserLogin.ExpireDate < DateTime.Now)
            {
                nResult[0] = "ERR";
                nResult[1] = "CheckUser_Error03";
                return(nResult);//"Expire On"
            }
            nResult[0] = "OK";
            nResult[1] = nUserLogin.Key;
            nResult[2] = nUserLogin.EmployeeKey.ToString();
            nUserLogin.UpdateDateLogin();
            return(nResult);
        }