# ------------------------------------------------------------------------- # Here is sample code if you need for # - email capabilities # - authentication (registration, login, logout, ... ) # - authorization (role based authorization) # - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss) # - old style crud actions # (more options discussed in gluon/tools.py) # ------------------------------------------------------------------------- from gluon.tools import Auth, Service, PluginManager # host names must be a list of allowed host names (glob syntax allowed) auth = Auth(db, host_names=myconf.get('host.names')) service = Service() plugins = PluginManager() #mz ++z auth.settings.extra_fields['auth_user'] = [ Field('fs', 'integer', readable=False, writable=False, default=14), ] #mz ++k # ------------------------------------------------------------------------- # create all tables needed by auth if not custom tables # ------------------------------------------------------------------------- auth.define_tables(username=False, signature=False) # ------------------------------------------------------------------------- # configure email # -------------------------------------------------------------------------
# response.optimize_css = 'concat,minify,inline' # response.optimize_js = 'concat,minify,inline' ######################################################################### ## Here is sample code if you need for ## - email capabilities ## - authentication (registration, login, logout, ... ) ## - authorization (role based authorization) ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss) ## - old style crud actions ## (more options discussed in gluon/tools.py) ######################################################################### from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) crud, service, plugins = Crud(db), Service(), PluginManager() # # Simple storage for study supporting files. These are stored temporary, # pending deposition in Dryad or another permanent repository. # # I'm adapting a recipe for using web2py with the jQuery-File-Upload plugin: # http://in10min.blogspot.com/2013/04/web2py-implement-multiple-files-upload.html # SupportingFiles = db.define_table('supporting_files', Field('doc', 'upload', autodelete=True), #Field('thumb', 'upload', autodelete=True), #Field('sizeFile', 'float'), #Field('sessionId', 'string'),)
######################################################################### ## Here is sample code if you need for ## - email capabilities ## - authentication (registration, login, logout, ... ) ## - authorization (role based authorization) ## - services (xml, csv, json, xmlrpc, jsonrpc, amf, rss) ## - crud actions ## (more options discussed in gluon/tools.py) ######################################################################### from gluon.tools import Mail, Auth, Crud, Service, PluginManager, prettydate mail = Mail() # mailer auth = Auth(db) # authentication/authorization crud = Crud(db) # for CRUD helpers using auth service = Service() # for json, xml, jsonrpc, xmlrpc, amfrpc plugins = PluginManager() # for configuring plugins mail.settings.server = 'logging' or 'smtp.gmail.com:587' # your SMTP server mail.settings.sender = '*****@*****.**' # your email mail.settings.login = '******' # your credentials or None auth.settings.hmac_key = 'sha512:89b9d005-19d8-47d3-b182-271fd9c7db8e' # before define_tables() auth.define_tables() # creates all needed tables auth.settings.mailer = mail # for user email verification auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.messages.verify_email = 'Click on the link http://' + request.env.http_host + URL( 'default', 'user', args=['verify_email']) + '/%(key)s to verify your email' auth.settings.reset_password_requires_verification = True auth.messages.reset_password = '******' + request.env.http_host + URL( 'default', 'user', args=['reset_password'