Re: login page help
Re: login page help
- Subject: Re: login page help
- From: josh <email@hidden>
- Date: Mon, 19 Jul 2004 14:39:22 -0700
It is another WOComponent and I tried before exactly what you suggested
and was unsuccessful. Good to know I was thinking in the right
direction. I tried adding it to the userCredentials (see code below)
where the other setObjectForKey statements are made, but the form would
return the error that there was nothing set for the value of accountID,
this makes sense as there was nothing entered in the form. I guess then
where I am getting stuck is how to get the accountID after the login is
entered, but before going to the next page and storing that in the
session.
For reference, here is the code from the main.java file for the login
page:
public class Main extends WOComponent {
public String feedback;
Session session = (Session) session();
/** @TypeInfo account */
protected EOEnterpriseObject account;
public boolean isAuthenticated() {
NSMutableDictionary userCredentials = new NSMutableDictionary();
if (session.Username == null || session.Password == null)
return false;
userCredentials.setObjectForKey(session.Username,"companyName");
userCredentials.setObjectForKey(session.Password,
"accountLogin_accountPassword");
NSArray foundObjects =
EOUtilities.objectsMatchingValues(session().defaultEditingContext(),
"account", userCredentials);
if (foundObjects.count()== 1)
return true;
NSLog.out.appendln("Authenticationfailed.");
return false;}
public WOComponent login()
{
if (isAuthenticated()) {
WOComponent nextPage = pageWithName("customerPortal");
return nextPage;
}
else {
feedback = "Please Try Again";
return null;
}
}
public Main(WOContext context) {
super(context);
}
}
josh
On Jul 19, 2004, at 1:54 PM, Bill Reynolds wrote:
Josh,
What is the 'account page', is it another WOComponent (page) that is
reached
during the same session as when your user logged in? If so, it has
access
to the Session where you can store the users 'account ID' in a Session
variable - the place designed for just such things.
-Bill
on 7/19/04 13:20, josh at email@hidden wrote:
I am a relative newbie to WO and Java. I am creating a site that will
require an account and the person to log in to view it. I have created
the login functionality checking against a database and the account
page, but I am stuck on how to get the account page to know which
account it has pulled. I can get it to display the account name from
the session and display it, but I am not sure how to get the account
page to look up the account ID of the person who logged in. Any
suggestions on this would be most helpful, or direct me to a great
resource that may help.
Thanks,
Josh Bradley
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.