Thanks James but also required=True don't have any effect. Perhaps I have 
to make a custom form or register, do you know I can do it ? 

Il giorno martedì 3 dicembre 2013 19:56:39 UTC+1, James Burke ha scritto:
>
> For problem no1, you could try using required=True instead of 
> requires=IS_NOT_EMPTY()
>
> For your second problem you can define the auth_user table yourself (from 
> web2py book):
>
> Another way to do this, although not really recommended, consists of 
> defining your auth tables yourself. If a table is declared before 
> auth.define_tables() it is used instead of the default one. Here is how 
> to do it:
>
> ## after auth = Auth(db)
> db.define_table(
>     auth.settings.table_user_name,
>     Field('first_name', length=128, default=''),
>     Field('last_name', length=128, default=''),
>     Field('email', length=128, default='', unique=True), # required
>     Field('password', 'password', length=512,            # required
>           readable=False, label='Password'),
>     Field('address'),
>     Field('city'),
>     Field('zip'),
>     Field('phone'),
>     Field('registration_key', length=512,                # required
>           writable=False, readable=False, default=''),
>     Field('reset_password_key', length=512,              # required
>           writable=False, readable=False, default=''),
>     Field('registration_id', length=512,                 # required
>           writable=False, readable=False, default=''))
>
> ## do not forget validators
> custom_auth_table = db[auth.settings.table_user_name] # get the 
> custom_auth_table
> custom_auth_table.first_name.requires =   
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> custom_auth_table.last_name.requires =   
> IS_NOT_EMPTY(error_message=auth.messages.is_empty)
> custom_auth_table.password.requires = [IS_STRONG(), CRYPT()]
> custom_auth_table.email.requires = [
>   IS_EMAIL(error_message=auth.messages.invalid_email),
>   IS_NOT_IN_DB(db, custom_auth_table.email)]
>
> auth.settings.table_user = custom_auth_table # tell auth to use 
> custom_auth_table
>
> ## before auth.define_tables()
>
>

-- 
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/groups/opt_out.

Reply via email to