Exemple #1
0
        public async Task <ResponseModel> Repwd(UpdatePwd updatepwd, HttpContext context)
        {
            var id   = context.Session.Get <sys_user>("yr_user").id;
            var user = await Db.Queryable <sys_user>().Where(c => c.id == id).SingleAsync();

            if (user.password == ToolBase.EncryptByMd5(updatepwd.oldpwd))
            {
                var query = await Db.Updateable <sys_user>().Where(c => c.id == id).UpdateColumns(c => new sys_user {
                    password = ToolBase.EncryptByMd5(updatepwd.newpwd)
                }).ExecuteCommandAsync();

                if (query >= 1)
                {
                    return(new ResponseModel {
                        code = 200, result = "修改成功~"
                    });
                }
                else
                {
                    return(new ResponseModel {
                        code = 0, result = "修改失败~"
                    });
                }
            }
            else
            {
                return(new ResponseModel {
                    code = 0, result = "旧密码有误~"
                });
            }
        }
Exemple #2
0
        private void btnXGmima_Click(object sender, EventArgs e)
        {
            UpdatePwd mp = new UpdatePwd();

            mp.Show();
        }
Exemple #3
0
        public async Task <JsonResult> Repwd(UpdatePwd updatepwd)
        {
            var res = await loginService.Repwd(updatepwd, HttpContext);

            return(Json(res));
        }
Exemple #4
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            var frm = new UpdatePwd();

            frm.ShowDialog();
        }