- Timestamp:
- 05/29/13 15:01:23 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/AccountController.cs
r8384 r9556 56 56 } 57 57 58 59 ////60 //// GET: /Account/Register61 58 62 //public ActionResult Register() { 63 // return View(); 64 //} 59 // 60 // GET: /Account/Register 65 61 66 //// 67 //// POST: /Account/Register 62 public ActionResult Register() { 63 return View(); 64 } 68 65 69 //[HttpPost] 70 //public ActionResult Register(RegisterModel model) { 71 // if (ModelState.IsValid) { 72 // // Attempt to register the user 73 // MembershipCreateStatus createStatus; 74 // Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); 66 // 67 // POST: /Account/Register 75 68 76 // if (createStatus == MembershipCreateStatus.Success) { 77 // FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); 78 // return RedirectToAction("Index", "Home"); 79 // } 80 // else { 81 // ModelState.AddModelError("", ErrorCodeToString(createStatus)); 82 // } 83 // } 69 [HttpPost] 70 public ActionResult Register(RegisterModel model) { 71 if (ModelState.IsValid) { 72 // Attempt to register the user 73 MembershipCreateStatus createStatus; 74 Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); 75 if (createStatus == MembershipCreateStatus.Success) { 76 Roles.AddUserToRole(model.UserName, "Web User"); 77 Roles.AddUserToRole(model.UserName, "Hive User"); 78 FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); 79 return RedirectToAction("Index", "Home"); 80 } 81 else { 82 ModelState.AddModelError("", ErrorCodeToString(createStatus)); 83 } 84 } 84 85 85 //// If we got this far, something failed, redisplay form86 //return View(model);87 //}86 // If we got this far, something failed, redisplay form 87 return View(model); 88 } 88 89 89 // //90 // //GET: /Account/ChangePassword90 // 91 // GET: /Account/ChangePassword 91 92 92 //[Authorize]93 //public ActionResult ChangePassword() {94 //return View();95 //}93 [Authorize] 94 public ActionResult ChangePassword() { 95 return View(); 96 } 96 97 97 // //98 // //POST: /Account/ChangePassword98 // 99 // POST: /Account/ChangePassword 99 100 100 //[Authorize]101 //[HttpPost]102 //public ActionResult ChangePassword(ChangePasswordModel model) {103 //if (ModelState.IsValid) {101 [Authorize] 102 [HttpPost] 103 public ActionResult ChangePassword(ChangePasswordModel model) { 104 if (ModelState.IsValid) { 104 105 105 //// ChangePassword will throw an exception rather106 //// than return false in certain failure scenarios.107 //bool changePasswordSucceeded;108 //try {109 //MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */);110 //changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword);111 //}112 //catch (Exception) {113 //changePasswordSucceeded = false;114 //}106 // ChangePassword will throw an exception rather 107 // than return false in certain failure scenarios. 108 bool changePasswordSucceeded; 109 try { 110 MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */); 111 changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword); 112 } 113 catch (Exception) { 114 changePasswordSucceeded = false; 115 } 115 116 116 //if (changePasswordSucceeded) {117 //return RedirectToAction("ChangePasswordSuccess");118 //}119 //else {120 //ModelState.AddModelError("", "The current password is incorrect or the new password is invalid.");121 //}122 //}117 if (changePasswordSucceeded) { 118 return RedirectToAction("ChangePasswordSuccess"); 119 } 120 else { 121 ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); 122 } 123 } 123 124 124 //// If we got this far, something failed, redisplay form125 //return View(model);126 //}125 // If we got this far, something failed, redisplay form 126 return View(model); 127 } 127 128 128 // //129 // //GET: /Account/ChangePasswordSuccess129 // 130 // GET: /Account/ChangePasswordSuccess 130 131 131 //public ActionResult ChangePasswordSuccess() {132 //return View();133 //}132 public ActionResult ChangePasswordSuccess() { 133 return View(); 134 } 134 135 135 136 #region Status Codes
Note: See TracChangeset
for help on using the changeset viewer.