Hi.. I'm new with WebObjects and also in web programming.
I chose WO to develop a Web Application (instead of RoR)..

Now.. I'm doing a login form.. Looking a screencast from David LeBer I moved the LoginAction from my Main.java file to DirectAction.
Everything works fine.. but ... One thing is annoying.

This is the method (I've to implement the encoding of password yet..)


        public WOActionResults loginAction() {
                        
                        WOComponent nextPage = null;
                        
                        String password = 
request().stringFormValueForKey("password");
                        String username = 
request().stringFormValueForKey("username");
                        String errorMessage = null;
                        
                        if (StringUtils.isEmpty(username) || 
StringUtils.isEmpty(password)) {
                                errorMessage  = "Username o password necessari";
                                password = null;
                        }
                        else
                        
                                try {
                                        User currentUser;
                                        
EOQualifier qualifier = User.USERNAME.eq(username).and(User.PASSWORD.eq(password)); currentUser = User.fetchRequiredUser(ERXEC.newEditingContext(),qualifier);
                                        if (! currentUser.active()) {
errorMessage = "Utente attualmente disabilitato. Contattare l'amministratore";
                                                password = null;
                                                currentUser = null;
                                                nextPage = 
pageWithName(Main.class.getName());
                                                nextPage.takeValueForKey(errorMessage, 
"errorMessage");
                                                nextPage.takeValueForKey(username, 
"username");
                                                return nextPage;
                                        }
                                        
((Session)session()).setCurrentUser(currentUser);

                                        String pageToRedirect = 
currentUser.group().mainPage();
                                        if (pageToRedirect==null)
                                                ;
                                        else {
                                                nextPage = 
pageWithName(pageToRedirect);
                                        }
                
                                        
                                }
                                catch (NoSuchElementException e) {
                                        errorMessage = "Utente non trovato o 
password sbagliata";
                                }
                                catch (Exception e) {
                                        NSLog.out.appendln("Some exceptions during 
login");
                                }
                                
                                if (! StringUtils.isEmpty(errorMessage)) {
                                        nextPage = 
pageWithName(Main.class.getName());
                                        nextPage.takeValueForKey(errorMessage, 
"errorMessage");
                                        nextPage.takeValueForKey(username, 
"username");
                                }
                        
                        return nextPage;
                }

Then... this is the URL after the action:
http://192.168.1.2:5100/cgi-bin/WebObjects/iPN.woa/wa/login
even when it's redirect to the WOComponent...
If someone refresh the page, a new login action is done, changing the session.
I'd like to have, after the login, the url changed to something like
 
http://192.168.1.2:5100/cgi-bin/WebObjects/iPN.woa/wo/xmxE5KfCss9XG4PiGGzmUg/0.0.5.1
so if someone press refresh the login action is not called...


Any help?

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to