public ActionResult Index(BootcampCapstone.Models.AccountModel.LogInModel lm)
        {
            UserQueries q = new UserQueries();
            UserQueries.VerificationResult r = q.VerifyUsernameAndPassword(lm.UserName, lm.Password);
            switch (r)
            {
                case UserQueries.VerificationResult.UserNameDoesNotExist:
                case UserQueries.VerificationResult.PasswordIncorrect:
                    ViewBag.Error = "Either password or username is incorrect.";
                    break;
                case UserQueries.VerificationResult.Correct:

                    var authTicket = new FormsAuthenticationTicket(
                    1,                             // version
                    lm.UserName,                      // user name
                    DateTime.Now,                  // created
                    DateTime.Now.AddMinutes(10),   // expires
                    false,                    // persistent?
                    "Moderator;Admin"                        // can be used to store roles
                    );

                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                    var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    System.Web.HttpContext.Current.Response.Cookies.Add(authCookie);
                    return RedirectToAction("Index", "Event");
            }
            return View();
        }
 public ActionResult LostPassword(BootcampCapstone.Models.AccountModel.LostPasswordModel lostPassModel)
 {
     string enteredUsername = lostPassModel.UserName;
     var user = db.Users.FirstOrDefault(i => i.username.ToUpper() == enteredUsername.ToUpper());
     if (user != null)
     {
     }
     else
     {
         ViewBag.Error = "Entered email address is not registered.";
     }
     return View();
 }
Esempio n. 3
0
 public ActionResult LogIn(BootcampCapstone.Models.AccountModel.LogInModel lm)
 {
     throw new Exception("HERHERHERHEREHR");
     return View(lm);
 }
 public ActionResult LogIn(BootcampCapstone.Models.AccountModel.LogInModel lm)
 {
     return View(lm);
 }
 public EventController(BootcampCapstone.Queries.IEventQueries eventQueries)
 {
     _eventQueries = eventQueries;
 }