public ActionResult Logon(string email, string password, bool stayloggedin) { var rep = GetRepository<User>(); var authenticate = new WebAuthentication(rep.All(),Response, Request); var AuthenticateSuccessful = authenticate.Authenicate(email.ToLower(), password, stayloggedin); //add the hit if (AuthenticateSuccessful == 0) GetRepository<Hit>().Add(authenticate._newHit); return new JsonResult { Data = new { Validation = AuthenticateSuccessful} }; }
public ActionResult activate(int id) { var rep = GetRepository<User>(); var ActivatedUser = rep.All().SingleOrDefault(u => u.Activated == false && u.ActivationCode == id); if (ActivatedUser != null) { ActivatedUser.Activated = true; DataSession.Save(ActivatedUser); //log in the user var authenticate = new WebAuthentication(GetRepository<User>().All(), Response, Request); authenticate.AuthenicateAuto(ActivatedUser.Email); //TODO: send a more detailed welcome email //redirect them to their dashboard return Redirect("/player"); } return Redirect("/home"); }
public ActionResult ChangeEmail(EmailChange model) { if (ModelState.IsValid) { //update the users Emailaddress var User = GetPlayer().User; if (User.Email.ToLower() == model.currentEmail.ToLower()) { User.Updated = SystemDate.Current(); User.Email = model.newEmail.ToLower(); //send updated email password if (EmailBuilder.SendNewEmailAddressEmail(User, User.Email)) { //Log you out var rep = GetRepository<User>(); var authenticate = new WebAuthentication(rep.All(), Response, Request); authenticate.LogOut(); //Login authenticate.AuthenicateAuto(model.newEmail.ToLower()); return Redirect("/Player"); } } return View(model); } else { return View(model); } }
public ActionResult LogOut() { var rep = GetRepository<User>(); var authenticate = new WebAuthentication(rep.All(),Response, Request); authenticate.LogOut(); //TODO: Refresh the same page we are on? return Redirect("/"); }