public ActionResult CreateUser(CreateUserModel model) { if (ModelState.IsValid) { // Email 或者 手机 string token = RdbmsWebSecurity.CreateUserAndAccount(model.UserName, model.Password, model.Email); if (token.HasValue()) { if (RdbmsWebSecurity.Login(model.UserName, model.Password, true)) { //去到个人信息页面 return(RedirectToAction("UserDetails", "Home", new { token = token, userName = model.UserName })); } } } return(View(model)); }
public ActionResult Login(LoginModel loginModel, string returnUrl) { if (ModelState.IsValid) { if (RdbmsWebSecurity.Login(loginModel.UserName, loginModel.Password, true)) { if (!string.IsNullOrEmpty(returnUrl) && Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } } return(View(loginModel)); }