Re: [Lift] Hooking up custom login logic with ProtoUser's logUserIn and actionsAfterSignup
On Feb 24, 11:09 am, dave wrote: > On Feb 24, 10:33 am, Jeppe Nejsum Madsen wrote: > > > > > > > On Wed, Feb 24, 2010 at 7:21 PM, dave wrote: > > > Further investigation leads me to believe that each pathway is either > > > working in a different session or that Lift just doesn't know about my > > > application's session. > > > > S.inStatefulScope_? returns true from the Lift pathway and false from > > > my own. > > > > I'll keep following this path, but, being a Lift newbie, any pointers > > > or tips to speed me along would be appreciated. > > > What is "your own" path way? Is it a browser request or a request from > > another servlet? If the latter, make sure you provide any session > > cookies/url parameters needed to correctly propagate the container > > session to lift. > > > This of course is also needed if it's a browser request, but if it's a > > request within the same web app, this should be handled > > automatically > > > /Jeppe > > Thanks Jeppe, > > The pathway that doesn't work is when trying to call logUserIn from my > own non-Lift servlet. We have the web.xml LiftFilter pointing to a > subfolder that doesn't contain that servlet so it is not in the Lift > session. > > I've just tried moving the LiftFilter to the full /* url-pattern > (instead of the previous /subfolder/*) and setting > LiftRules.passNotFoundToChain = true, but this is causing "Client did > not send n bytes as expected" errors on the regular servlet. > > Prior to calling logUserIn from my servlet, is it possible to manually > initialize Lift's S.session? I see S.initIfUninitted, but where/how > would I get a LiftSession? Progress, but still having some trouble. I've managed to sync up the Lift session with my Servlet session using SessionMaster.getSession to load the existing LiftSession, but this only works if I visit my http://domain.com/subfolder/user_mgt first, causing Lift to automatically create the initial LiftSession. If that session does not exist, I'm using LiftRules.sessionCreator to create a new LiftSession with my Servlet session (as shown below). In theory I think this should work--when I visit /subfolder/user_mgt/* it has the same session ID, but I think it may be creating a new LiftSession instead of using the existing one because the curUserId is Empty. Any thoughts/tips? Thanks!! val ls = SessionMaster.getSession(Request.session.getId, Empty) S.initIfUninitted(ls.openOr(LiftRules.sessionCreator( new provider.servlet.HTTPServletSession(Request.session), ""))) { User.logUserIn(user) } -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Hooking up custom login logic with ProtoUser's logUserIn and actionsAfterSignup
On Wed, Feb 24, 2010 at 7:21 PM, dave wrote: > Further investigation leads me to believe that each pathway is either > working in a different session or that Lift just doesn't know about my > application's session. > > S.inStatefulScope_? returns true from the Lift pathway and false from > my own. > > I'll keep following this path, but, being a Lift newbie, any pointers > or tips to speed me along would be appreciated. What is "your own" path way? Is it a browser request or a request from another servlet? If the latter, make sure you provide any session cookies/url parameters needed to correctly propagate the container session to lift. This of course is also needed if it's a browser request, but if it's a request within the same web app, this should be handled automatically /Jeppe -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Hooking up custom login logic with ProtoUser's logUserIn and actionsAfterSignup
Further investigation leads me to believe that each pathway is either working in a different session or that Lift just doesn't know about my application's session. S.inStatefulScope_? returns true from the Lift pathway and false from my own. I'll keep following this path, but, being a Lift newbie, any pointers or tips to speed me along would be appreciated. Thanks! dave On Feb 23, 2:47 pm, dave wrote: > Hello, > > I'm working on an application that has until now primarily used Lift > for the mapper framework (1.1-M8). This includes us extending Meta/ > MegaProtoUser to get the basic user account functionality while > rolling our own servlets and front-end client (not using Lift). > > Now we want to make use of the Lift ProtoUser views and functionality > for reset password, lost password, etc. I've tried including calls to > User.actionsAfterSignup and User.logUserIn from our own signup/signin > service methods so that those included forms will be in-sync with the > login status of our application. > > The problem is that calls to logUserIn and actionsAfterSignup don't > appear to do anything. User.currentUserId is always Empty and > navigating to the /user_mgt/login page does not redirect as if the > user is logged in, unless I specifically login through those created > pages. > > How can I hook our own signup/signin logic up to be in sync with the > ProtoUser functionality? > > Thanks for any pointers!! > dave > > For example, our signup/signin service methods went something like > (simplified): > > def signUp(...) = { > val user = User.create.email(email).password(password) > user.validate match { > // ok to save/create > //user.save // old approach > User.finalizeSignup(user) //--> defers to > User.actionsAfterSignup(user) > } > > } > > def signIn(...) = { > User.findByUsername(username) match { > case Full(user) if (user.password.match_?(password)) => { > // log user in > // ... > User.logUserIn(user) > } > } > > > > } -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Hooking up custom login logic with ProtoUser's logUserIn and actionsAfterSignup
Hello, I'm working on an application that has until now primarily used Lift for the mapper framework (1.1-M8). This includes us extending Meta/ MegaProtoUser to get the basic user account functionality while rolling our own servlets and front-end client (not using Lift). Now we want to make use of the Lift ProtoUser views and functionality for reset password, lost password, etc. I've tried including calls to User.actionsAfterSignup and User.logUserIn from our own signup/signin service methods so that those included forms will be in-sync with the login status of our application. The problem is that calls to logUserIn and actionsAfterSignup don't appear to do anything. User.currentUserId is always Empty and navigating to the /user_mgt/login page does not redirect as if the user is logged in, unless I specifically login through those created pages. How can I hook our own signup/signin logic up to be in sync with the ProtoUser functionality? Thanks for any pointers!! dave For example, our signup/signin service methods went something like (simplified): def signUp(...) = { val user = User.create.email(email).password(password) user.validate match { // ok to save/create //user.save // old approach User.finalizeSignup(user) //--> defers to User.actionsAfterSignup(user) } } def signIn(...) = { User.findByUsername(username) match { case Full(user) if (user.password.match_?(password)) => { // log user in // ... User.logUserIn(user) } } } -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.