Hi
I have a login page. The first time I test run my project and use the login
page to login using my db userid and password, I seem to be logging in with
a default userid. What is wrong with my code
I am particularly interested with what is wrong in my else clause in the
event btLogin_onWebEvent(CSpWebEvent)
I tried using addDBUserLogin by itself and that didn't work so added
setDBUserLogin to the scheme of things.
I have the following code in my pgLogin.java file
//[[SPIDER_EVENT<btLogin_onWebEvent>
public int btLogin_onWebEvent(CSpWebEvent event)
{
// ** Begin modified code. VELA/KC 1997.02.16
// get a reference to the current user profile, and snag
username/password from page
CSpUserProfile myUserProfile = CSpider.getUserProfile();
CSpValue myUserID = getDisplayFieldValue ( TB_USER_ID
);
CSpValue myPassword = getDisplayFieldValue (
TB_USER_PASSWORD ) ;
String sUserId = myUserID.toString();
// save username/password from page into session objects
(used by Security Object for password validation )
CSpider.putUserSessionObject (SO_USER_ID , myUserID ) ;
CSpider.putUserSessionObject (SO_USER_PASSWORD , myPassword
) ;
// note: may still need to code handler for password
validation error at the Security Object level - KC 1997.02.16
// ** End modified code. VELA/KC 1997.02.16
//** Begin added code: VELA/KC 1997.02.19
// force execution of security object and add database login
to the user profile.
int myResult = CSpider.getProject ().getSecurityObject
().doLookup ( myUserProfile ) ;
Lion.debugMessage ( "doLookup: " + myResult + "(" +
( myResult==PROCEED_WITH_BUILTIN_HANDLING ? "proceed" : ""
) +
( myResult==PROCEED_BUT_SKIP_BUILTIN_HANDLING ? "proceed but skip"
: "" ) +
( myResult==STOP_PROCESSING ? "stop" : "" ) + ")" );
// if myResult == STOP_PROCESSING, show error page and tell
user they don't exist.
if ( myResult == STOP_PROCESSING ) {
callErrorPage ( "Unknown user name. Please try
again. " ) ;
}
// otherwise, addDBUserLogin
else {
// add username/password to DBLogin....
CSpLogin myLogin = new CSpLogin (
myUserID.stringValue (), myPassword.stringValue () ) ;
CSpUserProfile newUserProfile =
CSpider.getUserProfile();
newUserProfile.addDBUserLogin ( "dsLionUser",
myLogin ) ;
myUserProfile.setDBUserLogin(newUserProfile.getDBUserLogin());
//myUserProfile.setSecurityObjectActivated ( true )
;
newUserProfile.setSecurityObjectActivated( true);
CSpider.setUserProfile(newUserProfile);
Lion.debugMessage ( "onbtLoginWebEvent - addDBUserLogin: " );
return(PROCEED);
}
//]]SPIDER_EVENT<btLogin_onWebEvent>
//[[SPIDER_EVENT<this_onBeforeDisplayEvent>
public int this_onBeforeDisplayEvent(CSpDisplayEvent event)
{
// de-activate the user profile whenever this page
// is hit to ensure new profile is constructed
CSpUserProfile userProfile = CSpider.getUserProfile();
userProfile.setSecurityObjectActivated( false );
CSpider.setUserProfile( userProfile );
return (PROCEED);
}
//]]SPIDER_EVENT<this_onBeforeDisplayEvent>
//]]SPIDER_EVENTS END
}
Isabel Kaluza
Junior Systems Planning Analyst
Saskatchewan Liquor and Gaming Authority
<mailto:[EMAIL PROTECTED]>
_________________________________________________________________________
For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
For dire need help, email: [EMAIL PROTECTED]