Hello!

i want to prevent users from logging in to a turbine app twice so i
derived the class org.apache.turbine.modules.actions.LoginUser as
follows:

package com.comp.stuff.modules.actions;

import java.util.Collection;
import java.util.Iterator;

import org.apache.commons.lang.StringUtils;
import org.apache.turbine.modules.actions.LoginUser;
import org.apache.turbine.om.security.TurbineUser;
import org.apache.turbine.services.session.TurbineSession;
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.security.TurbineSecurityException;

public class APLoginUser extends LoginUser {
    
    public void doPerform(RunData data)
                throws TurbineSecurityException
    {
        String username = data.getParameters().getString(CGI_USERNAME, "");

        if (StringUtils.isEmpty(username)) {
            return;
        }
        
        try {
            Collection users = TurbineSession.getActiveUsers();
            Iterator i = users.iterator();
            
            while (i.hasNext()) {
                TurbineUser user = (TurbineUser) i.next();
                if (user.getName().equals(username)) {
                    return;
                }
            }
        }
        catch (Exception e) {
            return;
        }
        
        super.doPerform(data);
    }
}

when i use the APLoginUser action class for app login i check if the
user is already an active user, if he is not an active user then i call
the doPerform of the LoginUser object. The login is ok, but turbine
displays the login screen Login.vm again, only when i login one more
time then turbine displays the index screen Index.vm as expected.

why does turbine display the login screen again? 

thx, Chris

-- 
mit freundlichen Gr��en / with kind regards
 
Ing. Christian J�lly @ Solutions
unycom  Information Technology Services GmbH
A-8042 Graz | Schmiedlstra�e 1 / III

Tel: ++43 (0)316 / 818 828 - 30
Fax: ++43 (0)316 / 818 828 - 38
[EMAIL PROTECTED]
http://www.unycom.com

"Das Schwein tr�gt seinen Namen nicht umsonst" - Stilbl�ten aus
Kinderaufs�tzen: (Musik)

Im Radio kommt oft ein Konzert von Antante und Allegro.


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

Reply via email to