Search code examples
pythonpython-2.7web2pyweb2py-modules

Custom login and register form in web2py


I am using

    form1= auth.login()
    form2= auth.register()

to generate the login and register forms in web2py, but now i want to delete some of the fields from these forms, how can i modify these predefined forms and add email verification in register form? I tried defining new forms, but then i don’t want to loose functionality provided by predefined forms.


Solution

  • Before:

     form1 = SQLFORM(....)
    

    You can do

     db.auth_user.fieldname.writable = db.auth_user.fieldname.readable = False
    

    You can also defined your own:

     db.define_table('auth_user', ....)
    

    before you auth.define_tables() and your won table will be used.