you may be able to use the onaccept handler of auth.register() to add 
custom processing to auth without too much extra work.  you can add extra 
fields to the auth form, and then do custom processing and let auth do the 
rest of the work.

On Thursday, September 27, 2012 6:24:15 AM UTC-7, Bruno Codeman wrote:
>
> Massimo, grazie per rispondere. Actually, I'm not using auth.register, I 
> have a table called company, which is the "main entity" in the system. In 
> my form, I have the data from both tables (the user must type the company 
> data and the user data - email, name and password - in the same form), so I 
> created a new controller and I'm saving the company data first, then I'm 
> saving user data. Here's the code:
>
> empresa_has_errors = 
> db.empresa._validate(**db.empresa._filter_fields(args)).items()
> usuario_has_errors = 
> db.usuario._validate(**db.usuario._filter_fields(args)).items()
> if not empresa_has_errors and not usuario_has_errors:
> id = db.empresa.insert(**db.empresa._filter_fields(args))
> db.usuario.insert(email = args.email, nome_completo = args.nome_completo,
>   empresa = id,telefone = args.telefone,
>   password = db.usuario.password.validate(args.password)[0])
> else:
> return dict(empresa = empresa_has_errors, usuario = usuario_has_errors)
>
> I want to keep this user as inactive until it clicks on the link send by 
> email. My questions:
>
> 1) Is there a way to do it with the auth email?
>
> 2) Should I create a custom form with the company data and use the user 
> action on the default controller, so I can set 
> registration_requires_verification = True and web2py automatically send 
> this email?
>
> Thanks!
>
> Em quinta-feira, 27 de setembro de 2012 09h39min14s UTC-3, Massimo Di 
> Pierro escreveu:
>>
>> auth.define_tables(username=False, signature=False)                      
>>                        
>> auth.settings.registration_requires_verification = False ### <<< change 
>> this to True
>>
>> On Wednesday, 26 September 2012 23:20:43 UTC-5, Bruno Codeman wrote:
>>>
>>> Hi!
>>>
>>> I'm creating a custom registration form (my registration form have more 
>>> than one table on db) , but I need to ask the user to confirm by email the 
>>> registration, clicking on a link. I would like to use the web2py native 
>>> feature of sending the email and just let the user log in after click the 
>>> confirmation link. There's any way to do it?
>>>
>>>
>>> Sorry for my bad english, it's 1:20AM here in Brazil, normally it's a 
>>> lil' bit better than this. :P
>>>
>>>
>>> Thanks!
>>>
>>

-- 



Reply via email to