Beispiel #1
0
        public ActionResult CompleteRegistration(RegisterViewModel rvm)
        {
            if (HttpContext.Session["provider"] == null || HttpContext.Session["providerUserId"] == null)
                return RedirectToAction("Index", "Home");

            try
            {
                _accountService.OAuthRegister(rvm.Username);
            }
            catch (UsernameAlreadyExistsException e)
            {
                ModelState.AddModelError("Username", e);
                return View(rvm);
            }

            return RedirectToAction("Index", "Home");
        }
Beispiel #2
0
        public ActionResult Register(RegisterViewModel rvm)
        {
            if (!ModelState.IsValid)
            {
                return View(rvm);
            }

            try
            {
                _accountService.RegisterNewUser(rvm.Username, rvm.Password);
            }
            catch (UsernameAlreadyExistsException e)
            {
                ModelState.AddModelError("Username", e);
                return View(rvm);
            }

            return RedirectToAction("Index", "Home");
        }