thanks this works : 

auth.settings.register_onvalidation(check_geo)

+

def check_geo(form):
      if not form.vars.lat or not form.vars.lng:
            redirect(url('registration_failed'))
           

Le dimanche 25 octobre 2015 13:34:36 UTC+1, Anthony a écrit :
>
> First, note that auth.settings.login_after_registration is only relevant 
> when auth.settings.registration_requires_verification = True, as that is 
> the only case where it makes sense to differentiate whether login should be 
> allowed immediately or not (when registration does not require 
> verification, the user can immediately login manually, so no reason not to 
> do it automatically).
>
> Anyway, if "geolocation user acceptance" is something that can be handled 
> automatically at time of registration, then just use an 
> auth.settings.register_onvalidation callback to do the check, and simply 
> reject the registration if the check fails. On the other hand, if some 
> manual approval process is required, then you should set 
> auth.settings.registration_requires_approval 
> = True, and that will disable login until the registration has been 
> approved by an admin.
>
> Anthony
>
> On Sunday, October 25, 2015 at 6:29:12 AM UTC-4, Pierre wrote:
>>
>> Yes ok but this is not what I want :
>>
>>
>> extracted from web2py book:
>>
>> "
>>
>> If you want to allow people to register and automatically log them in 
>> after registration but still want to send an email for verification so that 
>> they cannot login again after logout, unless they completed the 
>> instructions in the email, you can accomplish it as follows:
>>
>> auth.settings.registration_requires_verification = True
>> auth.settings.login_after_registration = True
>>
>> "
>> here is the problem :
>> I added some extra fields to auth_user to provide geolocation data 
>> howewer I cannot predict "geolocation user acceptance" so my idea was to 
>> simply delete the user account in case geolocation is refused. but this 
>> cannot be done since new user is logged in automatically (he cannot log out 
>> if his account is deleted). Now I think about a different strategy using 
>> permissions and roles like "cannot login till geolocation data provided". 
>> This seems like a lot of complexity to solve a simple task ?
>>
>> Le dimanche 25 octobre 2015 03:55:34 UTC+1, DenesL a écrit :
>>>
>>>
>>> You also need
>>>
>>> settings.registration_requires_verification = True
>>>
>>>
>>>
>>> On Saturday, October 24, 2015 at 8:30:52 PM UTC-4, Pierre wrote:
>>>>
>>>> Hi everyone,
>>>>
>>>> I tried to do it with no success with this:
>>>>
>>>> auth.settings.login_after_registration = False
>>>>
>>>> thanks for your help
>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to