示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ManagerProviderBase provider = ManagerProviderFactory.Current.GetCurrentInstance();
            int result = provider.DoLogin(txtLoginName.Value, txtOldPass.Value.Trim());

            if (result == 0)
            {
                MessageBoxHelper.ResponseScript(this.Page, "updatePassCallback(0,'老密码输入有误');");
                return;
            }
            if (result == -1)
            {
                MessageBoxHelper.ResponseScript(this.Page, "updatePassCallback(0,'修改失败.');");
                return;
            }
            if (result == 1)
            {
                provider.UpdatePassword(txtLoginName.Value, txtNewPass.Value.Trim());
                MessageBoxHelper.ResponseScript(this.Page, "updatePassCallback(1,'修改成功');");
                return;
            }
        }
示例#2
0
        private AjaxResult Login()
        {
            int    roleType  = this.GetFormValue("roletype", 0);
            string loginName = this.GetFormValue("loginname", "");
            string passWord  = this.GetFormValue("password", "");

            if (loginName == "" || passWord == "")
            {
                return(AjaxResult.resultWith(AjaxResultEnum.处理失败, "账号名或密码未输入", null));
            }
            ManagerProviderBase provider = ManagerProviderFactory.Current.GetInstance((HQEnums.ManagerRoleOptions)roleType);
            int result = provider.DoLogin(loginName, passWord);

            if (result == 0)
            {
                return(AjaxResult.resultWith(AjaxResultEnum.处理失败, "账号被锁定", null));
            }
            else if (result == 1)
            {
                return(AjaxResult.resultWith(AjaxResultEnum.请求成功));
            }
            return(AjaxResult.resultWith(AjaxResultEnum.处理失败, "账号名或密码错误", null));
        }