コード例 #1
0
 public virtual void ChangeAndPersistPassword(Context context, PasswordConfig secConfig, String currentPasswordText, String newPasswordText, String confirmedPasswordText)
 {
     if (newPasswordText != confirmedPasswordText)
     {
         throw new iSabayaException(Messages.Security.NewPasswordsNotConfirmed.Format(context.Configuration.DefaultLanguage.Code));
     }
     if (this.PasswordMatch(currentPasswordText))
     {
         Password newPassword = new Password(this, secConfig, newPasswordText);
         if (null != Configuration.CurrentConfiguration &&
             PassPasswordHistoryCheck(secConfig.PasswordHistoryDepth, newPassword))
         {
             Password previouswPassword = this.CurrentPassword;
             this.CurrentPassword = newPassword;
             context.Persist(previouswPassword);
             context.Persist(newPassword);
         }
         else
         {
             throw new iSabayaException(Messages.Security.FailPasswordHistory.Format(context.Configuration.DefaultLanguage.Code));
         }
     }
     else
     {
         throw new iSabayaException(Messages.Security.CurrentPasswordIsNotValid.Format(context.Configuration.DefaultLanguage.Code));
     }
 }
コード例 #2
0
        public virtual void ResetPassword(PasswordConfig secConfig, String newPasswordText)
        {
            Password newPassword      = new Password(this, secConfig, newPasswordText);
            Password previousPassword = this.CurrentPassword;

            if (null != this.CurrentPassword)
            {
                this.CurrentPassword.EffectivePeriod.ExpiryDate = newPassword.EffectivePeriod.EffectiveDate;
            }
            this.CurrentPassword             = newPassword;
            this.ConsecutiveFailedLoginCount = 0;
        }
コード例 #3
0
ファイル: Password.cs プロジェクト: NiponJaiboon/RiskEval
        public Password(User user, PasswordConfig pwdConfig, String plainPasswordText)
        {
            if (null == user)
            {
                throw new iSabayaException(Messages.SecurityUserPersonIsNull);
            }

            if (null != pwdConfig)
            {
                pwdConfig.ValidatePassword(plainPasswordText);
            }

            this.user = user;
            if (String.IsNullOrEmpty(this.Salt))
            {
                this.encryptedPassword = Encrypt(user.LoginName + plainPasswordText);
            }
            else
            {
                this.encryptedPassword = Encrypt(user.LoginName + plainPasswordText);
            }
        }