public bool Authorize() { var security = new EidssSecurityManager(); var result = security.LogIn(Organization, UserName, Password); if (result == 0) //authorized { //set current language EidssUserContext.CurrentLanguage = Cultures.GetLanguageAbbreviation(LanguagePreference); System.Web.Security.FormsAuthentication.SetAuthCookie(this.UserName, false); HttpContext.Current.Session["UserName"] = UserName; return(true); } else { ErrorMessage = SecurityMessages.GetLoginErrorMessage(result); return(false); } }
public ActionResult Layout(string queryId, string layoutId, string ticket, string lang) { if (!string.IsNullOrEmpty(ticket)) { EidssSecurityManager target = new EidssSecurityManager(); int res = target.LogIn(ticket); if (res == 0) { System.Web.Security.FormsAuthentication.SetAuthCookie(EidssUserContext.User.LoginName, false); if (!string.IsNullOrEmpty(lang)) { EidssUserContext.CurrentLanguage = Cultures.GetLanguageAbbreviation(lang); } return(Redirect(String.Format("/{0}{1}?queryId={2}&layoutId={3}", lang, "/Layout/Layout", queryId, layoutId))); } } SetSelectedLanguage(); return(View("LoginLang", new eidss.avr.mweb.Models.Login())); }
public ActionResult LoginLang(string ticket = null, string lang = null) { //LoginHelper.Logout(this); if (!string.IsNullOrEmpty(ticket)) { EidssSecurityManager target = new EidssSecurityManager(); int res = target.LogIn(ticket); if (res == 0) { System.Web.Security.FormsAuthentication.SetAuthCookie(EidssUserContext.User.LoginName, false); if (!string.IsNullOrEmpty(lang)) { EidssUserContext.CurrentLanguage = Cultures.GetLanguageAbbreviation(lang); } return(Redirect(String.Format("/{0}{1}", lang, "/QueryLayoutTree/QueryLayoutTree"))); } } SetSelectedLanguage(); return(View(new eidss.avr.mweb.Models.Login())); }
/*public bool ValidateOnChange() * { * if (NewPassword != ConfirmPassword) * { * ErrorMessage = Translator.GetMessageString("msgConfirmPasswordError"); * return false; * } * var security = new EidssSecurityManager(); * var result = security.LogIn(Organization, UserName, OldPassword); * if (result == 0) //authorized * { * return true; * } * else * { * ErrorMessage = SecurityMessages.GetLoginErrorMessage(result); * return false; * } * }*/ public bool Authorize() { var security = new EidssSecurityManager(); var result = security.LogIn(Organization, UserName, Password); switch (result) { case 0: EidssUserContext.CurrentLanguage = Cultures.GetLanguageAbbreviation(LanguagePreference); System.Web.Security.FormsAuthentication.SetAuthCookie(this.UserName, false); return(true); case 6: int lockInMinutes = security.GetAccountLockTimeout(this.Organization, this.UserName); string err = BvMessages.Get("ErrLoginIsLocked", "You have exceeded the number of incorrect login attempts. Please try again in {0} minutes."); ErrorMessage = string.Format(err, lockInMinutes); return(false); default: ErrorMessage = SecurityMessages.GetLoginErrorMessage(result); return(false); } }