public ActionResult LogIN(LogInModel logInModel) { if (ModelState.IsValid) { var user = DatabaseObject.db.Users.Where(u => u.Username == logInModel.username).FirstOrDefault(); var status = LogInHelper.LogIn(user, logInModel); if (status == EnumLoginStatus.Success) { DatabaseObject.db.Entry((User)LoginToken.LoginUser).State = System.Data.Entity.EntityState.Modified; DatabaseObject.db.SaveChanges(); ResourceManager RM = new ResourceManager("ITS.Resources.ResourcesFiles.MapLabel", Assembly.GetExecutingAssembly()); ISDCore.Resources.MapLabels(ref RM); return(RedirectToAction(LogInHelper.SuccessAction, LogInHelper.SuccessController)); } else if (status == EnumLoginStatus.AccountBlocked) { Session["ErrorLogInMsg"] = Resources.ResourcesFiles.MapLabel.BlockedAccount; return(RedirectToAction(LogInHelper.FailAction, LogInHelper.FailController)); } else if (status == EnumLoginStatus.InvalidAccount) { Session["ErrorLogInMsg"] = Resources.ResourcesFiles.MapLabel.InvalidPassword; return(RedirectToAction(LogInHelper.FailAction, LogInHelper.FailController)); } else if (status == EnumLoginStatus.UserNotFound) { Session["ErrorLogInMsg"] = Resources.ResourcesFiles.MapLabel.Invalidusername; return(RedirectToAction(LogInHelper.FailAction, LogInHelper.FailController)); } } return(RedirectToAction(Settings.HomeAction, Settings.HomeController)); }
//new W_Login().show(); protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); try { LogInHelper.LogCookieCheck(CookieHelper.GetCookie()); new MainWindow().Show(); } catch (Exception) { new W_Login().Show(); } }
public ActionResult ForgetPassword(string Email) { var user = DatabaseObject.db.Users.Where(u => u.Email == Email).FirstOrDefault(); var result = LogInHelper.ForgetPassword(user); if (result) { ViewBag.Result = "Password Sent Correctly"; } else { ViewBag.Result = "Something Went Wrong Please try Again"; } return(View()); }
public ActionResult LogOut() { LogInHelper.LogOut(); return(RedirectToAction(LogInHelper.LogoutAction, LogInHelper.LogoutController)); }