[web2py] Re: Ajax and Auth API

2012-09-02 Thread Osman Masood
I know this is kind of old, but this post explains how to do AJAX login/register/forgot password in web2py without LOAD: AJAX auth functions: login, register, and retrieve_password (reset_password) in web2py http://osman.am/wordpress/?p=1 It's pretty easy to see how to extend the functionality

[web2py] Re: Ajax and Auth API

2010-03-31 Thread Yannick
Thanks Massimo for the note, I really appreciate your help... Now I have more control on the layout using your latest change thx... BUT there are few problems... the next doesn't seems to work I have to do this: 1) - auth.settings.register_next= URL(r=request,c='controller', f='index') to

[web2py] Re: Ajax and Auth API

2010-03-30 Thread Yannick
Thanks for the note I followed your instructions step by step unfortunately even this solution doesn't work... the Action dictate the display, I have NO control on the view... # #here is the view Register.html: # {{=form.custom.begin}} Full Name: input class=string id=auth_user_fullname

[web2py] Re: Ajax and Auth API

2010-03-30 Thread mdipierro
One more try.. closer to the solutions... view as before and action def register(): ... next = URL(r=request,f='index') return dict(form=auth.register(onaccept=lambda form: (updateInfo(form),response.headers.update({'web2py-component- command':document.location='%s'%next} On

[web2py] Re: Ajax and Auth API

2010-03-27 Thread Yannick
Hello Massimo, First thanks for you help... I'm stil not successful with customizing the form for Auth Api using Ajax. Please let me know what I'm doing wrong... Here is my view and controller (I did not extend Layout.html) # # Register.html ## html script

[web2py] Re: Ajax and Auth API

2010-03-27 Thread mdipierro
IF, as I assume, the register action is called via the {{=LOAD('controller','register')}} helper THEN there should be no ajax handling in register.html. It should just be: {{=form.custom.begin}} Full Name: input class=string id=auth_user_fullname name=fullname type=text value= / Email: input

[web2py] Re: Ajax and Auth API

2010-03-26 Thread Yannick
Thanks Massimo, Yes it's working now... Thousand thanks... BUT I still don't know how I can have more control on the display of each field: Like it's possible to load each field and display them as I want ? - And I also wanted to know how to catch the error messages so I can display them like I

[web2py] Re: Ajax and Auth API

2010-03-26 Thread mdipierro
You just need a view for register.html that does not extend layout and contains a custom form. On Mar 26, 6:49 am, Yannick ytchatch...@gmail.com wrote: Thanks Massimo, Yes it's working now... Thousand thanks... BUT I still don't know how I can have more control on the display of each field:

[web2py] Re: Ajax and Auth API

2010-03-25 Thread mdipierro
One more try def register(): next = URL(r=request,f='index') return auth.register(onaccept=lambda form:response.headers.update({'web2py-component- command':document.location='%s'%next})) On Mar 25, 11:58 am, Yannick ytchatch...@gmail.com wrote: Hello thanks Massimo for the note... But I

[web2py] Re: Ajax and Auth API

2010-03-25 Thread Yannick
Thanks for the note... But I tried it, I don't have the error anymore but the data is not saved in the DB... I run in debug mode and put and break point in my action def register(): and I notice that the form validation is not successful in the method register() of the Class Auth() of Tools.py...

[web2py] Re: Ajax and Auth API

2010-03-25 Thread mdipierro
I think something else must be interfering with the session formkeys. I would need to look at the complete action and view. On Mar 25, 7:27 pm, Yannick ytchatch...@gmail.com wrote: Thanks for the note... But I tried it, I don't have the error anymore but the data is not saved in the DB... I run

[web2py] Re: Ajax and Auth API

2010-03-25 Thread Yannick
Thanks. Here is the complete action: # I'm testing the registration with Ajax and here # is my simple Controller from applications.TestApp.modules.ControllerUtils import * controlUtils = ControllerUtils(db)

[web2py] Re: Ajax and Auth API

2010-03-25 Thread mdipierro
You have two problems: 1) you are calling register twice. In index() and the LOAD callback. That generates two forms and confuses web2py on which one you are submitting. So index should just be 2) You specify onaccept both in settings and as argument of the register function. The latter

[web2py] Re: Ajax and Auth API

2010-03-24 Thread mdipierro
You should make your own action and use {{=LOAD(..)}} On Mar 24, 9:32 am, Yannick ytchatch...@gmail.com wrote: Hello mate, This can be an easy question but I don't know how to used the Web2py Ajax (u,s,t) function to call build-in Web2py Authentication API. It's there any example ?... There

[web2py] Re: Ajax and Auth API

2010-03-24 Thread Yannick
Sorry I really don't understand... I have to code my own Auth function like register(), login() etc... it that what you meant ? Yes I know I have to create my own action but I wanted to re-use the Auth Api function by calling them inside my action... So basically what you are saying is that i

[web2py] Re: Ajax and Auth API

2010-03-24 Thread mdipierro
show us your action and explan how you want it to behave in details, and I can post an example. On Mar 24, 11:06 am, Yannick ytchatch...@gmail.com wrote: Sorry I really don't understand... I have to code my own Auth function like register(), login() etc... it that what you meant ? Yes I know

[web2py] Re: Ajax and Auth API

2010-03-24 Thread Yannick
Ok here is a view form to change user password: ### script $(#pwdChangeForm).submit(function(){ url={{=URL(r=requet, f=changePwd)}}; ids = ['currentpwd', 'pwd1', 'pwd2']; ajax(url, ids, 'confirmationMsg'); # This is the Ajax method that

[web2py] Re: Ajax and Auth API

2010-03-24 Thread mdipierro
### script $(#pwdChangeForm).submit(function(){ url={{=URL(r=requet, f=changePwd)}}; ids = ['currentpwd', 'pwd1', 'pwd2']; ajax(url, ids, 'confirmationMsg'); # This is the Ajax method that is coming with Web2py return false; });

[web2py] Re: Ajax and Auth API

2010-03-24 Thread Yannick
Sorry but I have a lot of syntax error in the action: auth.change_password(onaccept=lambda form: response.headers['web2py- component-command']=document.location='%s'%next)) I don't seems to see why... Please let me know if you see it... Thanks, On Mar 24, 2:00 pm, mdipierro

[web2py] Re: Ajax and Auth API

2010-03-24 Thread mdipierro
My bad auth.change_password(onaccept=lambda form: response.headers.update({'web2py- component-command']:document.location='%s'%next})) On Mar 24, 8:21 pm, Yannick ytchatch...@gmail.com wrote: Sorry but I have a lot of syntax error in the action: auth.change_password(onaccept=lambda form: