Esempio n. 1
0
        public IActionResult Register(RegisterAccountForm registration)
        {
            logger.Info("Developer Portal: Register - Posted");
            try
            {
                if (ModelState.IsValid)
                {
                    DeveloperAccountDTO account = auth.RegisterUser(registration);
                    logger.Info("Developer Portal: Register - Posted - New User Created", account.ForLogging());
                    return(RedirectToAction("AccountHome"));
                }

                ViewBag.FormError = true;
                return(View());
            }
            catch (Exception e)
            {
                logger.Error("Developer Portal: Regiester - Posted ERROR", e);
                if (e.GetType() == typeof(EmailAlreadyExistsError))
                {
                    ViewBag.EmailAlreadyExists = true;
                }
                else
                {
                    ViewBag.DatabaseError = true;
                }
                return(View());
            }
        }
Esempio n. 2
0
 public IActionResult SignIn(SignInForm signInForm)
 {
     logger.Info("Developer Portal: SignIn - Posted");
     try
     {
         DeveloperAccountDTO account = auth.AuthenticateUser(signInForm);
         logger.Info("Developer Portal: SignIn - Posted - Successfully Signed In", account.ForLogging());
         return(RedirectToAction("AccountHome"));
     }
     catch (Exception e)
     {
         logger.Info("Developer Portal: SignIn - Posted ERROR", e);
         return(View());
     }
 }
Esempio n. 3
0
 public IActionResult EditAccount()
 {
     logger.Info("Developer Portal: EditAccount - Requested");
     if (auth.IsSignedIn)
     {
         ViewData["Title"] = "Edit Account";
         DeveloperAccountDTO account = auth.CurrentUser;
         logger.Info("Developer Portal: EditAccount - Requested - Account Info", account.ForLogging());
         return(View(new EditAccountViewModel(account)));
     }
     logger.Info("Developer Portal: EditAccount - Requested - Not Signed In");
     return(RedirectToAction("SignIn"));
 }