portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions JLoginUser.java
Date Thu, 08 Jan 2004 03:11:16 GMT
taylor      2004/01/07 19:11:16

  Modified:    src/java/org/apache/jetspeed/modules/actions JLoginUser.java
  Log:
  patch to fix auto disable user feature
  
  Revision  Changes    Path
  1.38      +24 -16    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLoginUser.java
  
  Index: JLoginUser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/JLoginUser.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- JLoginUser.java	29 Oct 2003 21:35:14 -0000	1.37
  +++ JLoginUser.java	8 Jan 2004 03:11:16 -0000	1.38
  @@ -253,7 +253,7 @@
               JetspeedSecurity.saveUser(user);
           }
           catch (LoginException e)
  -        {
  +        {            
               data.setScreenTemplate(JetspeedResources.getString(TurbineConstants.TEMPLATE_LOGIN));
               String message = e.getMessage() != null ? e.getMessage() : e.toString();
               data.setMessage(message);
  @@ -262,8 +262,11 @@
   
               if (e instanceof FailedLoginException)
               {
  -                logger.info("JLoginUser: Credential Failure on login for user: " + username);
  -                data.setMessage(Localization.getString(rundata, "PASSWORDFORM_FAILED_MSG"));
  +                if (!disableCheck(data))
  +                {                
  +                    logger.info("JLoginUser: Credential Failure on login for user: " +
username);
  +                    data.setMessage(Localization.getString(rundata, "PASSWORDFORM_FAILED_MSG"));
  +                }
               }
               else if (e instanceof AccountExpiredException)
               {
  @@ -291,7 +294,6 @@
               data.setUser(juser);
               return;
           }
  -
           if (user.getDisabled())
           {
               data.setMessage(Localization.getString(rundata, "JLOGINUSER_ACCOUNT_DISABLED"));
  @@ -301,7 +303,6 @@
           }
   
           // check for being confirmed before allowing someone to finish logging in
  -
           if ( data.getUser().hasLoggedIn())
           {
               if  (JetspeedSecurity.isDisableAccountCheckEnabled())
  @@ -392,19 +393,26 @@
           }
           else
           {
  -            // disable user after a configurable number of strikes
  -            if  (JetspeedSecurity.isDisableAccountCheckEnabled())
  -            {
  -                boolean disabled = JetspeedSecurity.checkDisableAccount(data.getParameters().getString("username",
""));
  -                if (disabled)
  -                {
  -                    data.setMessage(Localization.getString(rundata, "JLOGINUSER_ACCOUNT_DISABLED"));
  -                    data.setScreenTemplate(JetspeedResources.getString("logon.disabled.form"));
  -                    data.getUser().setHasLoggedIn(new Boolean (false) );
  -                }
  -            }
  +            disableCheck(data);
           }
   
       }
   
  +    private boolean disableCheck(JetspeedRunData data)
  +    {
  +        boolean disabled = false;
  +        // disable user after a configurable number of strikes
  +        if  (JetspeedSecurity.isDisableAccountCheckEnabled())
  +        {
  +            disabled = JetspeedSecurity.checkDisableAccount(data.getParameters().getString("username",
""));
  +            
  +            if (disabled)
  +            {
  +                data.setMessage(Localization.getString(data, "JLOGINUSER_ACCOUNT_DISABLED"));
  +                data.setScreenTemplate(JetspeedResources.getString("logon.disabled.form"));
  +                data.getUser().setHasLoggedIn(new Boolean (false) );
  +            }
  +        }
  +        return disabled;
  +    }
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message