public long ChangeUserPsw(string oldPsw, string newPsw) { BaseSearchModel se = new BaseSearchModel("bw_user"); se["ID"] = LoginInfo.Current.UserID; var user = se.LoadEntity<BW_User>(); if (user.UserPsw.Equals(Encryption.GetMD5(oldPsw))) { user = new BW_User(); user["ID"] = LoginInfo.Current.UserID; user.UserPsw = Encryption.GetMD5(newPsw); return user.Save(); } return 0; }
public JsonResult LoginIn(string uname, string psw, int remember) { BaseSearchModel sm = new BaseSearchModel("bw_user"); sm.LoginUserName = uname; var user = sm.LoadEntity<BW_User>(); if (user != null) { if (user.UserPsw.Equals(Encryption.GetMD5(psw))) { LoginInfo loginInfo = new LoginInfo(uname); var uid = user.ID; loginInfo.UserID = uid; loginInfo.UserRole = user.UserRole; LoginInfo.SetLoginToken(loginInfo, remember == 1 ? true : false); return this.JsonNet(new { result = uid, url = "" }); } } return this.JsonNet(new { result = 0 }); }