I got this to work, but think there should be an easier way. I added the following snippet to the default user controller:
# if user clicked a link and registers, take them to the meeting after the registration component logs them in if request.args[0] == 'register' and len(session.next) > 0: auth.settings.register_next = session.next what is not clear is why this could not be set in the default/index controller (see previous attempt). On Sep 27, 7:38 am, "david.waldrop" <david.wald...@gmail.com> wrote: > massimo, i need to be able to redirect the user after registration, > not login. But only when the user has clicked on an invitation link - > i.e. not always. It seems to me the auth.settings.register_next is > not working (or i do not understand how it works). > > I see in the default user controller that this redirect: > > redirect(URL(r=request,f='user',args='login',vars=dict(_next=next))) > passes in the url to go to after successful login, and this works as > expected. It handles the case where a user was sent an invitation link > and WAS ALREADY a registered user, > > but this statement: > auth.settings.register_next = next > does not seem to do anything > > Lastly I do not see where the default user controller get invoked > after register, but before it auto-logs the user in. In other words I > do not know where to put my code and what would signal it. > > On Sep 26, 9:58 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > > store the url is session.next and after login if session.next redirect > > there and clear the variable. > > > On Sep 26, 4:48 am, "david.waldrop" <david.wald...@gmail.com> wrote: > > > > I have an application that enables users to invite others by > > > capturing > > > their email address and sending an email invite. The invite includes > > > a link to a specific 'community'. When the user clicks the link they > > > are taken to the application. If they are already registered (which > > > is not the case on 1st run experience) they are taken directly to the > > > meeting. What I have not been able to figure out is how I take the > > > user to the meeting when they are a brand new user and have to > > > register first. I studied several posts where you and others were > > > debating the changes to trunk and the various paths to accomplish > > > this > > > but did not see a solution. > > > > The goal is the following: > > > 1) user clicks link > > > 2) system displays login screen > > > 3) user selects to register > > > 4) system registers and logs user in > > > 5) system takes user to correct community > > > > Here is what I have in me default/index controller now: > > > > def index(): > > > if not auth.is_logged_in(): > > > # if user clicked email link, redirect to login and set url > > > to > > > get and check meeting password > > > #meetingparm = request.env.http_host.split('.')[1] > > > #meeting = db(db.meeting.link==meetingparm).select().first() > > > meeting = db(db.meeting.link).select().first() > > > if meeting: # user clicked a link with a valid meeting, > > > lets get'em logged in and figure out who they are > > > next = > > > URL(r=request,c='meetings',f='getmeetingpassword',args=meeting.id) > > > auth.settings.register_onaccept=lambda form: > > > redirect(next) > > > auth.settings.register_next = next > > > redirect(URL(r=request,f='user',args='login',vars=dict(_next=next))) > > > return dict(message=T('')) > > > > The problem is I do not see how to ask web2Py to redirect to > > > "next' (see code above) if they have to register first and are auto- > > > logged in.