Doh! I actually misspelled the parameter in my TR.props file. When I
put in the incorrect eventSubmit_ information, I get the login screen
with the message that it couldn't find that button - which is correct.
And when I put in the incorrect user ID or password, I get the login
screen, which is also correct. Not sure what the root of your problem
might be. I've got the following in my login.vm:
<FORM method="POST"
action="$link.setPage("index.vm").setAction("LoginUser")">
And it only goes to index.vm when the Action succeeds. I don't have an
Index class to verify that the user is logged in.
Hmmm....
Will Stranathan
Will Stranathan wrote:
> How strange. When I deliberately remove the eventSubmit_doLogin (or
> change it to something else,) I get the attached unhandled exception.
> However, everything functions as expected when I set it properly - I get
> sent back to login.vm if the userID or password is wrong.
>
> Make sure eventSubmit_doLogin is getting set to something. I wish I
> could duplicate the propblem. (Also, it appears that turbine has to be
> shutdown and restart for it to re-read TR.props)
>
> Will Stranathan
>
> java.lang.NullPointerException
> at java.util.Hashtable.containsKey(Hashtable.java(Compiled Code))
> at
>
>org.apache.turbine.services.template.TurbineTemplateService.getLayoutTemplateName(TurbineTemplateService.java:283)
>
>
> at
>
>org.apache.turbine.services.template.TurbineTemplate.getLayoutTemplateName(TurbineTemplate.java:85)
>
>
> at
>
>org.apache.turbine.modules.pages.TemplatePage.doBuildAfterAction(TemplatePage.java:141)
>
>
> at
> org.apache.turbine.modules.pages.DefaultPage.doBuild(DefaultPage.java:157)
> at org.apache.turbine.modules.Page.build(Page.java:92)
> at org.apache.turbine.modules.PageLoader.exec(PageLoader.java:122)
> at org.apache.turbine.Turbine.doGet(Turbine.java:372)
> at org.apache.turbine.Turbine.doPost(Turbine.java:459)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
> org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
> at org.apache.tomcat.core.Handler.service(Handler.java:286)
> at
> org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
> org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:799)
>
> at
> org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
> at
>
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>
>
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
> at java.lang.Thread.run(Thread.java:498)
>
>
> Martin Poeschl wrote:
>
>> i'm frustrated!!!!
>>
>> my velocity login app still does not work ... i am able to login now,
>> but if i login with a wrong username/password the index.vm is shown ...
>> i would expect login.vm to be shown again ...
>>
>> here is my LoginUser.java
>>
>> package org.test.login.modules.actions;
>>
>> import org.apache.velocity.Context;
>>
>> import org.apache.turbine.modules.actions.VelocityAction;
>> import org.apache.turbine.om.security.User;
>> import org.apache.turbine.util.RunData;
>> import org.apache.turbine.services.security.TurbineSecurity;
>> import org.apache.turbine.services.resources.TurbineResources;
>> import org.apache.turbine.util.security.TurbineSecurityException;
>>
>> public class LoginUser extends VelocityAction
>> {
>> public void doLogin(RunData data, Context context)
>> throws Exception
>> {
>> // This prevents a db hit on second Action call during page
>> // generation. Turbine removes everything from the Session
>> // before calling this method, so in this case we should
>> // continue on with the Login procedure.
>>
>> if ( data.getUserFromSession() != null )
>> {
>> return;
>> }
>>
>> String username = data.getParameters().getString ( "username",
>> "" );
>> String password = data.getParameters().getString ( "password",
>> "" );
>>
>> User user = null;
>> try
>> {
>> // Authenticate the user and get the object.
>> user = TurbineSecurity.getAuthenticatedUser( username,
>> password );
>>
>> // Store the user object.
>> data.setUser(user);
>>
>> // Mark the user as being logged in.
>> user.setHasLoggedIn(new Boolean(true));
>>
>> // Set the last_login date in the database.
>> user.updateLastLogin();
>>
>> // This only happens if the user is valid; otherwise, we
>> // will get a valueBound in the User object when we don't
>> // want to because the username is not set yet. Save the
>> // User object into the session.
>> data.save();
>> }
>> catch ( TurbineSecurityException e )
>> {
>> System.out.println(e.getMessage());
>> data.setMessage(TurbineResources.getString("login.error"));
>> // Retrieve an anonymous user.
>> data.setUser (TurbineSecurity.getAnonymousUser());
>> setTemplate (data,
>> TurbineResources.getString("template.login"));
>> }
>> }
>>
>> /**
>> * This is used in the event that doLogin above fails.
>> */
>> public void doPerform(RunData data, Context context)
>> throws Exception
>> {
>> data.setMessage("Can't find the button!");
>> // Retrieve an anonymous user.
>> data.setUser (TurbineSecurity.getAnonymousUser());
>> setTemplate (data,
>> TurbineResources.getString("template.login"));
>> }
>> }
>>
>>
>> in TR.properties
>>
>> template.login = login.vm
>>
>> please help!!!!
>>
>>
>>
>>
>> ------------------------------------------------------------
>> To subscribe: [EMAIL PROTECTED]
>> To unsubscribe: [EMAIL PROTECTED]
>> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
>> Problems?: [EMAIL PROTECTED]
>
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]