/// <summary> /// 用户自己改密码,需要验证旧密码 /// </summary> /// <param name="form"></param> /// <returns></returns> public bool ChangeSelfPassword(ChangePasswordUpdateForm form) { string token = ServiceSession.Current.Context.Parameters["token"].ToString(); var user = bll.GetUserFormCache(); ChangePasswordUpdateForm newForm = new ChangePasswordUpdateForm { UserID = user.User.ID, OldPassword = form.OldPassword, NewPassword = form.NewPassword, }; return bll.ChangeSelfPassword(newForm); }
public bool ChangeSelfPassword(ChangePasswordUpdateForm form) { ISqlMapper mapper = Common.GetMapperFromSession(); UserDao dao = new UserDao(mapper); var useraccount = dao.Query(new UserQueryForm { ID = form.UserID, Password = form.OldPassword }).FirstOrDefault(); if (useraccount == null) { throw new Exception("用户名或者旧密码错误!"); } Model.User user = new Model.User { ID = form.UserID, Password = form.NewPassword, }; dao.Update(new UserUpdateForm { Entity = user, UserQueryForm = new UserQueryForm { ID = user.ID } }); return true; }
public bool ChangePassword(ChangePasswordUpdateForm form) { return bll.ChangePassword(form); }
public bool ChangePassword(ChangePasswordUpdateForm form) { ISqlMapper mapper = Common.GetMapperFromSession(); UserDao dao = new UserDao(mapper); Model.User user = new User { ID = form.UserID, Password = form.NewPassword, }; dao.Update(new UserUpdateForm { Entity = user }); return true; }