public ActionResult edit(EditPasswordViewModel m) { m.Password = Global.md5(m.Password); m.Password1 = Global.md5(m.Password1); m.Password2 = Global.md5(m.Password2); if (!isLogin()) return RedirectToAction("login", "auth"); Provider db = new Provider(); if (m.Password1 != m.Password2) { ViewData["error"] = "两次密码不一样"; return View(); } User u = getCurrentUser(); if (u.Password != m.Password) { ViewData["error"] = "密码错了,再试试吧"; return View(); } u.Password = m.Password1; db.updateUser(u); UserInfo ui = new UserInfo(); ui.Id = u.Id; ui.Address = m.Address; ui.Phone = m.Phone; ui.Email = m.Email; ui.Info = m.Info; db.updateUserInfo(ui); return View("EditSuccess"); }
public ActionResult edit() { if (!isLogin()) return RedirectToAction("login", "auth"); Provider db = new Provider(); User u=getCurrentUser(); UserInfo userinfo=db.getUserInfo(u.Id); EditPasswordViewModel obj = new EditPasswordViewModel(); obj.Address = userinfo.Address; obj.Phone = userinfo.Phone; obj.Email = userinfo.Email; obj.Info = userinfo.Info; obj.Password = ""; obj.Password1 = ""; obj.Password2 = ""; return View(obj); }