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 void Login(string Organization, string User, string Password, string Language) { if (!Localizer.SupportedLanguages.ContainsKey(Language)) { throw new SoapException("Language is not supported", SoapException.ClientFaultCode); } Thread.CurrentThread.CurrentUICulture = new CultureInfo(Localizer.SupportedLanguages[Language]); var security = new EidssSecurityManager(); var result = security.LogIn(Organization, User, Password); if (result == 0) //authorized { //set current language EidssUserContext.CurrentLanguage = Language; } else { throw new SoapException(SecurityMessages.GetLoginErrorMessage(result), SoapException.ClientFaultCode); } }
/*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); } }
public void btnOk_Click(Object sender, EventArgs e) { if (!ValidateData()) { return; } try { var errMessage = PasswordValidatorHelper.ChangePassword(txtOrganization.Text, txtUserName.Text, txtPassword.Text, txtNewPassword1.Text, txtNewPassword2.Text); if (errMessage != null) { ErrorForm.ShowMessageDirect(errMessage); return; } DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { if (SqlExceptionHandler.Handle(ex)) { return; } string errMessage; if (ex is SqlException) { errMessage = SecurityMessages.GetDBErrorMessage((ex as SqlException).Number, null, null); } else { errMessage = SecurityMessages.GetDBErrorMessage(0, null, null); } ErrorForm.ShowErrorDirect(errMessage, ex); } }
private void btnOk_Click(Object sender, EventArgs e) { string errorMessage = string.Empty; var errorCode = -1; var bSuccessLogin = false; try { if (!ValidateArchiveConnection()) { return; } if (!ValidateAvrService()) { return; } InitConnection(); bSuccessLogin = DoLogin(m_Manager, txtOrganization.Text, txtUserName.Text, txtPassword.Text, out errorCode); if (!bSuccessLogin) { switch (errorCode) { case 6: errorMessage = SecurityMessages.GetLoginErrorMessage(errorCode, txtOrganization.Text, txtUserName.Text); break; default: errorMessage = SecurityMessages.GetLoginErrorMessage(errorCode); break; } } } catch (Exception ex) { if (SqlExceptionHandler.Handle(ex)) { m_LoginType = LoginType.Complex; UpdateTabsVisibility(); return; } errorMessage = SqlExceptionMessage.Get(ex); if (errorMessage == null) { Dbg.Debug("unprocessed error during login: {0}", ex); errorMessage = StandardErrorHelper.Error(StandardError.UnprocessedError); } else { errorMessage = BvMessages.Get(errorMessage); } } if (bSuccessLogin) { SuccessLogin(); } else { FailedLogin(errorMessage, errorCode); } }