mpoeschl    01/05/29 08:44:10

  Modified:    src/java/org/apache/jyve/modules/actions
                        ConfirmAndLogin.java JyveLogin.java
               src/java/org/apache/jyve/modules/navigations TopBar.java
               src/java/org/apache/jyve/modules/util JSecurityCheck.java
  Log:
  -fix error in TopBar
  -user has to confirm her account before she can log in
  
  Revision  Changes    Path
  1.6       +6 -5      
jakarta-turbine-jyve/src/java/org/apache/jyve/modules/actions/ConfirmAndLogin.java
  
  Index: ConfirmAndLogin.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jyve/src/java/org/apache/jyve/modules/actions/ConfirmAndLogin.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ConfirmAndLogin.java      2001/05/08 01:01:03     1.5
  +++ ConfirmAndLogin.java      2001/05/29 15:44:01     1.6
  @@ -59,6 +59,8 @@
   import java.sql.*;
   import java.util.*;
   
  +import org.apache.jyve.modules.util.JSecurityCheck;
  +
   // External Stuff
   import org.apache.turbine.modules.*;
   import org.apache.turbine.modules.actions.VelocityAction;
  @@ -86,8 +88,6 @@
    */
   public class ConfirmAndLogin extends VelocityAction
   {
  -    /** this is the value that is stored in the database for confirmed users */
  -    private static final String CONFIRM_VALUE = "CONFIRMED";
   
   
       /**
  @@ -118,7 +118,8 @@
           // check to make sure the user entered the right confirmation key
           // if not, then send them to the ConfirmRegistration screen
           String confirm_value = user.getConfirmed();
  -        if ( ! secretkey.equals ( confirm_value ) && ! confirm_value.equals ( 
CONFIRM_VALUE ) )
  +        if ( ! secretkey.equals ( confirm_value )
  +             && ! confirm_value.equals(JSecurityCheck.CONFIRM_VALUE) )
           {
               data.setMessage(Localization.getString("JLOGINUSER_KEYNOTVALID"));
               data.setScreenTemplate("ConfirmRegistration.vm");
  @@ -126,9 +127,9 @@
           }
   
           // if the user is not confirmed
  -        if ( ! confirm_value.equals ( CONFIRM_VALUE ) )
  +        if ( ! confirm_value.equals(JSecurityCheck.CONFIRM_VALUE) )
           {
  -            user.setConfirmed(CONFIRM_VALUE);
  +            user.setConfirmed(JSecurityCheck.CONFIRM_VALUE);
               TurbineSecurity.saveUser(user);
   
               // get the group for jyve
  
  
  
  1.4       +11 -3     
jakarta-turbine-jyve/src/java/org/apache/jyve/modules/actions/JyveLogin.java
  
  Index: JyveLogin.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jyve/src/java/org/apache/jyve/modules/actions/JyveLogin.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JyveLogin.java    2001/05/08 01:01:04     1.3
  +++ JyveLogin.java    2001/05/29 15:44:02     1.4
  @@ -56,7 +56,7 @@
   
   import java.math.BigDecimal;
   
  -import org.apache.velocity.context.Context;
  +import org.apache.jyve.modules.util.JSecurityCheck;
   
   import org.apache.turbine.om.NumberKey;
   import org.apache.turbine.om.security.User;
  @@ -67,6 +67,8 @@
   import org.apache.turbine.services.resources.TurbineResources;
   import org.apache.turbine.services.security.TurbineSecurity;
   
  +import org.apache.velocity.context.Context;
  +
   /**
    * Login for Jyve.
    *
  @@ -77,14 +79,20 @@
   {
       public void doPerform( RunData data, Context context ) throws Exception
       {
  -        String username = data.getParameters().getString ( "username", "" );
  -        String password = data.getParameters().getString ( "password", "" );
  +        String username = data.getParameters().getString( "username", "" );
  +        String password = data.getParameters().getString( "password", "" );
           User user = null;
           try
           {
               // Authenticate the user and get the object.
               user = TurbineSecurity.getAuthenticatedUser( username, password );
   
  +            // check if account is confirmed
  +            if (! JSecurityCheck.CONFIRM_VALUE.equals(user.getConfirmed()))
  +            {
  +                data.setScreenTemplate("ConfirmRegistration.vm");
  +                return;
  +            }
               // Store the user object.
               data.setUser(user);
   
  
  
  
  1.7       +3 -3      
jakarta-turbine-jyve/src/java/org/apache/jyve/modules/navigations/TopBar.java
  
  Index: TopBar.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jyve/src/java/org/apache/jyve/modules/navigations/TopBar.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TopBar.java       2001/05/08 01:01:14     1.6
  +++ TopBar.java       2001/05/29 15:44:05     1.7
  @@ -126,7 +126,7 @@
           if (ProjectPeer.TABLE_NAME.equals(table))
           {
               NumberKey project_id = (NumberKey) data.getUser().getTemp("project_id");
  -            if ( project_id == null )
  +            if ( project_id == null || project_id.getBigDecimal().intValue() == 0 )
               {
                   return null;
               }
  @@ -137,7 +137,7 @@
           else if (FaqPeer.TABLE_NAME.equals(table))
           {
               NumberKey faq_id = (NumberKey) data.getUser().getTemp("faq_id");
  -            if ( faq_id == null )
  +            if ( faq_id == null || faq_id.getBigDecimal().intValue() == 0 )
               {
                   return null;
               }
  @@ -148,7 +148,7 @@
           else if (TopicPeer.TABLE_NAME.equals(table))
           {
               NumberKey topic_id = (NumberKey) data.getUser().getTemp("topic_id");
  -            if ( topic_id == null )
  +            if ( topic_id == null || topic_id.getBigDecimal().intValue() == 0 )
               {
                   return null;
               }
  
  
  
  1.5       +3 -0      
jakarta-turbine-jyve/src/java/org/apache/jyve/modules/util/JSecurityCheck.java
  
  Index: JSecurityCheck.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-jyve/src/java/org/apache/jyve/modules/util/JSecurityCheck.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JSecurityCheck.java       2001/05/08 01:01:23     1.4
  +++ JSecurityCheck.java       2001/05/29 15:44:08     1.5
  @@ -74,9 +74,12 @@
    * </code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";> Bernie H&ouml;neisen</a>, ETH 
Zurich
  + * @author <a href="mailto:[EMAIL PROTECTED]";> Martin Poeschl</a>
    */
   public class JSecurityCheck
   {
  +    /** this is the value that is stored in the database for confirmed users */
  +    public static final String CONFIRM_VALUE = "CONFIRMED";
   
       private String message;
       private String failScreen;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to