Strange. I had some ajax calls in the registration section already, which I 
took out because they didn't seem to do anything. You know ... 
response.js='ajax...' I thought I had it working at some point, but then it 
stopped working. Hmm... looks like I have some debugging to do. ;-)

On Sunday, April 8, 2012 10:48:45 AM UTC+8, Anthony wrote:
>
> auth.settings.register_onaccept is a callback executed from the 
> auth.register() function. But you have created your own register() 
> function, which does not call auth.register(), hence the callback is never 
> called. Since you have an entirely custom registration function, you'll 
> have to call complete_login() yourself in the "if" block of your code.
>
> Anthony 
>
>
> On Saturday, April 7, 2012 10:00:24 PM UTC-4, weheh wrote:
>>
>> In the typical 0_db.py file I'm setting
>>
>> auth.settings.register_onaccept=[complete_login]
>>
>>
>>
>> I also define complete_login there and it raises an 
>>     HTTP(200)
>> for a redirect.
>>
>> Now, in my "user" controller I have:
>>
>> def register():
>>     ...
>>     register_form = SQLFORM.factory( db.auth_user, ...  )
>>     ...
>>     if register_form.process(formname='register-form', onvalidation=
>> validate_registration).accepted:
>>         # create user
>>         user_id = db.auth_user.insert(
>>                 first_name='',
>>                 last_name='',
>>                 email=register_form.vars.email,
>>                 ... other stuff ...
>>                 password=register_form.vars.password,
>>
>>                 )
>>         ... do a lot of group and permission stuff ...
>>         # auto log them in 
>>         from gluon.storage import Storage, Settings, Messages
>>         session.auth = Storage(user=db.auth_user[user_id], last_visit=
>> request.now,
>>                 expiration=auth.settings.expiration) 
>>     elif register_form.errors:
>>         response.flash = T('Please correct error in registration form')
>>     return dict(register_form=register_form)
>>
>>
>> The problem is, the 
>>
>> complete_login()
>>
>> function is not getting executed after register() returns. Why not?
>>
>> FWIW, I also have auth.settings.login_onaccept set as well, but it's 
>> function isn't getting executed either.
>>
>

Reply via email to