예제 #1
0
        public virtual ActionResult CreateUser(RegisterViewModel model)
        {
            MembershipUser user;
            MembershipCreateStatus status;
            user = membershipService.CreateUser(model.UserName, model.Password, model.Email, model.SecretQuestion, model.SecretAnswer, model.Approve, out status);

            return routeHelpers.Actions.GrantRolesToUser(user.UserName);
        }
예제 #2
0
 public virtual ActionResult CreateUser()
 {
     var model = new RegisterViewModel()
     {
         RequireSecretQuestionAndAnswer = membershipService.RequiresQuestionAndAnswer
     };
     return View(model);
 }
예제 #3
0
        public virtual ActionResult Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                // Attempt to register the user
                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.Email, model.SecretQuestion, model.SecretAnswer, true, out createStatus);

                if (createStatus == MembershipCreateStatus.Success)
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }

            return RedirectToAction("Register");
        }
        public virtual ActionResult CreateUser(RegisterViewModel model)
        {
            MembershipUser user;
            if (model.RequireSecretQuestionAndAnswer)
            {
                MembershipCreateStatus status;
                user = membershipService.CreateUser(model.UserName, model.Password, model.Email, model.SecretQuestion, model.SecretAnswer, model.Approve, out status);
            }
            else
            {
                user = membershipService.CreateUser(model.UserName, model.Password, model.Email);
            }

            return Actions.GrantRolesToUser(user.UserName);
        }
 public virtual ActionResult Confirmation(RegisterViewModel model)
 {
     ViewBag.Email = model.Email;
     return View();
 }