It
form = auth()
Below example of my login form refactoring :
def user():
"""
exposes:
http://..../[app]/default/user/login
http://..../[app]/default/user/logout
http://..../[app]/default/user/register
http://..../[app]/default/user/profile
http://..../[app]/default/user/retrieve_password
http://..../[app]/default/user/change_password
use @auth.requires_login()
@auth.requires_membership('group name')
@auth.requires_permission('read','table name',record_id)
to decorate functions that need access control
"""
auth.settings.label_separator = ''
auth.settings.formstyle = 'divs'
form = auth()
if request.args(0) == 'login':
# form.element(_name='email')['_placeholder'] = T('Email')
# form.element(_name='email')['_style'] = 'width: 275px;'
form.element(_name='username')['_placeholder'] = T('Username')
form.element(_name='username')['_style'] = 'width: 275px;'
form.element(_name='password')['_placeholder'] = T('Password')
form.element(_name='password')['_style'] = 'width: 275px;'
form.element(_type='submit').update(_value=T('Log in'), _class='btn
btn-small btn-inverse')
#form[0][1][2].append(A(T('Forgot your password?'),
_href=URL(c='default',
#
f='user', args=('request_reset_password'))))
response.flash = T('Please login!')
return dict(form=form)
elif request.args(0) == 'profile':
redirect(URL(c='directory', f='user_profile'))
elif request.args(0) == 'request_reset_password':
form.element(_name='email')['_placeholder'] = T('Email')
form.element(_name='email')['_style'] = 'width: 275px;'
form.element(_type='submit').update(_value=T('Send'), _class='btn
btn-small btn-inverse')
return dict(form=form)
elif request.args(0) == 'change_password':
form.element(_name='old_password')['_placeholder'] = T('Old
password')
form.element(_name='old_password')['_style'] = 'width: 275px;'
form.element(_name='new_password')['_placeholder'] = T('New
password')
form.element(_name='new_password')['_style'] = 'width: 275px;'
form.element(_name='new_password2')['_placeholder'] = T('New
password')
form.element(_name='new_password2')['_style'] = 'width: 275px;'
form.element(_type='submit').update(_class='btn btn-small
btn-inverse')
return dict(form=form)
elif request.args(0) == 'not_authorized':
redirect(URL(c='permission', f='not_authorized'))
# if not 'request_reset_password' in
auth.settings.actions_disabled:
# return dict(form=auth()) # Don't understand utility maybe
removed
else:
return dict(form=form)
return dict(form=form)
On Sun, Dec 6, 2015 at 8:48 PM, Richard Vézina <[email protected]>
wrote:
> login form are part of web2py auth.form or something I haven touch that
> since a wild... But you have to custom the form and login form is par of
> controllers/default/user function... You then need to have a look at the
> book to how customize login form...
>
> You may also just try to set readable=True and writable=True on your field
> definition it may works... But I am not sure...
>
> Richard
>
> On Fri, Dec 4, 2015 at 5:12 PM, Jonathan R <[email protected]> wrote:
>
>> Hi Richard,
>> I've seen people using this way to customize their registration page,
>> they could get the radio button to be displayed, I don't really see how the
>> login page is different and won't display it, I must miss something.
>>
>> What "other thing" should I do in your opinion ?
>>
>> thanks for your time.
>>
>> --
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.