Example #1
0
plugins = PluginManager()

# create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

# configure email
mail = auth.settings.mailer
mail.settings.server ='logging' if request.is_local else myconf.get('smtp.server')
mail.settings.sender ='logging' if request.is_local else myconf.get('smtp.sender')
mail.settings.login ='******' if request.is_local else myconf.get('smtp.login')
mail.settings.tls = True
mail.settings.ssl = False


# configure auth policy
auth.next = None
auth.navbar(referrer_actions=None)
auth.settings.registration_requires_verification = True
auth.messages.email_sent = "A verification email has been sent to you! Follow it's link to proceed."
auth.messages.verify_email_subject = 'Verify your account with ResearchConnect'
#auth.messages.verify_email = 'Thanks for signing up with ResearchConnect! We hope you look forward to connecting with professors and finding the research project you have been searching for. But first, we need you to follow this link'  https://toasthater.pythonanywhere.com/ResearchConnect/default/verify_email/%(key)s
auth.settings.login_next = URL('main')
auth.settings.register_next = URL('index')
auth.settings.create_user_groups = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_next = URL('../index')
auth.settings.request_reset_password_next = URL('../index')
auth.settings.reset_password_requires_verification = True
auth.settings.register_verify_password = False
auth.add_group('professor','professor permissions')
auth.add_group('student','student permissions')
Example #2
0
plugins = PluginManager()

## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

## configure email
mail = auth.settings.mailer
mail.settings.server = 'logging' if request.is_local else 'smtp.gmail.com:587'
mail.settings.sender = '*****@*****.**'
mail.settings.login = '******'

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True
auth.next = None
auth.settings.login_next = URL('dashboard')


## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in private/janrain.key
from gluon.contrib.login_methods.janrain_account import use_janrain
use_janrain(auth, filename='private/janrain.key')

#########################################################################
## Define your tables below (or better in another model file) for example
##
## >>> db.define_table('mytable',Field('myfield','string'))
##
## Fields can be 'string','text','password','integer','double','boolean'
##       'date','time','datetime','blob','upload', 'reference TABLENAME'
Example #3
0
from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()

## adding the extra fields for the athletes database
auth.settings.extra_fields['auth_user']= [
  Field('image', 'upload'),
  Field('year', 'string', requires=IS_IN_SET(['Freshman', 'Sophomore', 'Junior', 'Senior'])),
  Field('sex', 'string', requires=IS_IN_SET(['Male', 'Female'])),
  Field('sport', requires=IS_IN_SET(['Basketball', 'Dodgeball', 'Flag Football',
        'Indoor Soccer', 'Soccer', 'Softball', 'Volleyball', 'Ultimate Frisbee', 'Water Polo'])),
  Field('staff', 'boolean', default=False, readable=False, writable=False),]

## change register redirect to the profile page
auth.next = None ##in order to allow register_next to take effect
auth.settings.register_next = URL('user',args=['profile'])

## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)

custom_auth = db[auth.settings.table_user_name]
custom_auth.email.requires = IS_EMAIL(forced='^.*\ucsc.edu(|\..*)$', error_message='Please enter your @ucsc.edu email.')


## configure email
mail=auth.settings.mailer
mail.settings.server = 'logging' or 'smtp.gmail.com:587'
mail.settings.sender = '*****@*****.**'
mail.settings.login = '******'