[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
There are settings for almost everything. Sometimes the book doesn't explain every single one though. The best way to figure out what's going on is to open the gluon/tools.py file, and find the Auth class. This class will have all the settings listed with their default values at the top of the class.
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
This is not working (it remains E-mail): auth.messages.label_email = 'Email' Are you using the default auth.define_tables() to create you Auth models? You may need to show some code. Remember me (for 30 days works) - but there is a space above it up to password - how to remove it? Try inspecting the rendered HTML and figure out what the HTML/CSS should be -- then we can figure out how to generate it. Anthony
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
Also on Sign Up form I got a message 'too short' below the Password field - in the book link there is not correspondent function to change it. That's coming from the default CRYPT validator. Try: db.auth_user.password.requires[-1].error_message = 'Your custom error message' This assumes requires is a list (which it is by default when using auth.define_tables) -- if it is just a single CRYPT object, then no need for the [-1]. Anthony
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
Actually I need just to change Remember me (for 30 days) to Remember mebr(for 30 days)
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
auth.messages.label_remember_me = CAT('Remember me', BR(), '(for 30 days)') or auth.messages.label_remember_me = XML('Remember mebr(for 30 days)') should do it. If you need special CSS styling, you could put the label inside a span with a specific class. Anthony On Monday, January 23, 2012 5:59:25 PM UTC-5, thstart wrote: Actually I need just to change Remember me (for 30 days) to Remember mebr(for 30 days)
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
Thank you Anthony, will try it!
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
It worked. Now I want to change *formstyle* and default labels: 1) E-mail to Email 2) The message in red below Email: Invalid email to Please enter a valid email address. 3) The message in red below password: too short to Please enter a valid password. too short is actually misleading because I am hitting Sign Up with all fields empty. auth.settings.login_onvalidation = login_email_lower current.app.auth = auth form=current.app.auth.login(next=login_next) form.custom.submit['_data-theme'] = 'e' form.custom.submit_button = 'Sign In' like in: form_add_email_address = SQLFORM.factory( Field('email_address', requires=[IS_NOT_EMPTY(), IS_EMAIL(error_message='invalid email!')]), submit_button = 'Add', *formstyle *= 'table2cols' )
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
There should be settings for all that stuff here: http://web2py.com/books/default/chapter/29/9#Settings-and-messages -- mostly in auth.messages. Anthony On Monday, January 23, 2012 7:39:45 PM UTC-5, thstart wrote: It worked. Now I want to change *formstyle* and default labels: 1) E-mail to Email 2) The message in red below Email: Invalid email to Please enter a valid email address. 3) The message in red below password: too short to Please enter a valid password. too short is actually misleading because I am hitting Sign Up with all fields empty. auth.settings.login_onvalidation = login_email_lower current.app.auth = auth form=current.app.auth.login(next=login_next) form.custom.submit['_data-theme'] = 'e' form.custom.submit_button = 'Sign In' like in: form_add_email_address = SQLFORM.factory( Field('email_address', requires=[IS_NOT_EMPTY(), IS_EMAIL(error_message='invalid email!')]), submit_button = 'Add', *formstyle *= 'table2cols' )
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
This is working: auth.settings.formstyle ='divs' This is not working (it remains E-mail): auth.messages.label_email = 'Email' Remember me (for 30 days works) - but there is a space above it up to password - how to remove it?
[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?
Also on Sign Up form I got a message 'too short' below the Password field - in the book link there is not correspondent function to change it. Additionally, tried to change auth.messages.invalid_email = 'Please enter a valid email address' But it still shows 'Invalid email'