• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
DirectActions and URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DirectActions and URL


  • Subject: DirectActions and URL
  • From: Francesco Romano <email@hidden>
  • Date: Thu, 27 Nov 2008 16:59:52 +0100

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: experiencing java.lang.StackOverflowErrors WO 5.4.3/Project Wonder
  • Next by Date: Re: Webobjects-dev Digest, Vol 5, Issue 1141
  • Previous by thread: experiencing java.lang.StackOverflowErrors WO 5.4.3/Project Wonder
  • Next by thread: Re: DirectActions and URL
  • Index(es):
    • Date
    • Thread