Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
that seems to be a better check. I think I'll do that. Checking the profile.
The ==1 seems not to be working when I passed the code to my test machine,
don't know why yet

On Tue, Jul 12, 2011 at 6:18 PM, pbreit  wrote:

> There's also auth.settings.login_next
>
> Perhaps you could set one or the other and then figure out some sort of
> check you can do to determine if it's a first login or not. A better check
> than first login might be if the profile is sufficiently filled out or not.
>


Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread pbreit
There's also auth.settings.login_next

Perhaps you could set one or the other and then figure out some sort of 
check you can do to determine if it's a first login or not. A better check 
than first login might be if the profile is sufficiently filled out or not.


Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
I solved it this way:

eventLogin = db(db.auth_event.user_id == auth.user.id).select()
if len(eventLogin) == 1:
session.flash= 'This is the first time you log in, please fill in
your profile'
redirect(URL('default','user/profile'))
#Obtain the row in audienceInstances table f

Thanks Bruno

On Tue, Jul 12, 2011 at 3:22 PM, Bruno Rocha  wrote:

> Auth has an auth_event which stores login events for users.
>
> You can make a count on event table to know if it is first time ligin.
>
> http://zerp.ly/rochacbruno
> Em 12/07/2011 11:57, "Nicolas Palumbo"  escreveu:
>
> > Any ideas on how to implement this?
> >
> > On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo 
> wrote:
> >
> >> I'm currently using ldap to auth with ldap_auth module of web2py.
> >> Currently if you are successful to login, are automatically redirected
> >> to index page.
> >> Which happens the first time the user log in to the system as well.
> >> I'd like to detect if it is the first time for a user to log into the
> >> system and then redirect to profile edition.
> >> Any ideas?
> >>
> >> I was advised to to this:
> >> auth.settings.register_next = URL('defaul', 'user', args=['profile'])
> >> But is not working, I think is because users are not registering. They
> >> just log in.
> >>
> >> Thanks in advance,
> >> Nico
> >>
>


Re: [web2py] Re: redirect to profile if first time login

2011-07-12 Thread Bruno Rocha
Auth has an auth_event which stores login events for users.

You can make a count on event table to know if it is first time ligin.

http://zerp.ly/rochacbruno
Em 12/07/2011 11:57, "Nicolas Palumbo"  escreveu:
> Any ideas on how to implement this?
>
> On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo 
wrote:
>
>> I'm currently using ldap to auth with ldap_auth module of web2py.
>> Currently if you are successful to login, are automatically redirected
>> to index page.
>> Which happens the first time the user log in to the system as well.
>> I'd like to detect if it is the first time for a user to log into the
>> system and then redirect to profile edition.
>> Any ideas?
>>
>> I was advised to to this:
>> auth.settings.register_next = URL('defaul', 'user', args=['profile'])
>> But is not working, I think is because users are not registering. They
>> just log in.
>>
>> Thanks in advance,
>> Nico
>>


[web2py] Re: redirect to profile if first time login

2011-07-12 Thread Nicolas Palumbo
Any ideas on how to implement this?

On Wed, Jul 6, 2011 at 7:13 PM, Nicolas Palumbo  wrote:

> I'm currently using ldap to auth with ldap_auth module of web2py.
> Currently if you are successful to login, are automatically redirected
> to index page.
> Which  happens the first time the user log in to the system as well.
> I'd like to detect if it is the first time for a user to log into the
> system and then redirect to profile edition.
> Any ideas?
>
> I was advised to to this:
> auth.settings.register_next = URL('defaul', 'user', args=['profile'])
> But is not working, I think is because users are not registering. They
> just log in.
>
> Thanks in advance,
> Nico
>