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("/"); }