def __init__(self, db): self.db = db self.hmac_key = Auth.get_or_create_key() Auth.__init__(self, self.db, hmac_key=self.hmac_key) #self.settings.logout_onlogout = lambda user: remove_session(user) #self.settings.register_onaccept = lambda form: add_to_users_group(form) self.settings.controller = 'person' self.settings.on_failed_authorization = self.url('account', args='not_authorized') self.settings.formstyle = 'divs' self.settings.label_separator = '' self.settings.register_next = self.url('show') self.settings.registration_requires_verification = self.db.config.auth.registration_requires_verification self.settings.registration_requires_approval = self.db.config.auth.registration_requires_approval if 'register' in self.db.request.args and self.db.config.auth.use_recaptcha: from gluon.tools import Recaptcha recaptcha_options = dict(self.db.config.get_list('auth', 'recaptcha')) self.settings.captcha = Recaptcha(self.db.request, recaptcha_options['public'], recaptcha_options['private'], options="theme:'%(theme)s', lang:'%(lang)s'" % recaptcha_options) from datamodel.user import User user = User(self) self.entity = user.entity if self.db.config.auth.server == 'default': self.settings.mailer = Mailer(self.db) else: self.settings.mailer.server = self.db.config.auth.server self.settings.mailer.sender = self.db.config.auth.sender self.settings.mailer.login = self.db.config.auth.login
def __init__(self, db): self.db = db self.hmac_key = Auth.get_or_create_key() Auth.__init__(self, self.db, hmac_key=self.hmac_key) #self.settings.logout_onlogout = lambda user: remove_session(user) #self.settings.register_onaccept = lambda form: add_to_users_group(form) self.settings.controller = 'person' self.settings.on_failed_authorization = self.url('account', args='not_authorized') self.settings.formstyle = 'divs' self.settings.label_separator = '' self.settings.register_next = self.url('show') self.settings.registration_requires_verification = self.db.config.auth.registration_requires_verification self.settings.registration_requires_approval = self.db.config.auth.registration_requires_approval if 'register' in self.db.request.args and self.db.config.auth.use_recaptcha: from gluon.tools import Recaptcha recaptcha_options = dict( self.db.config.get_list('auth', 'recaptcha')) self.settings.captcha = Recaptcha( self.db.request, recaptcha_options['public'], recaptcha_options['private'], options="theme:'%(theme)s', lang:'%(lang)s'" % recaptcha_options) from datamodel.user import User user = User(self) self.entity = user.entity if self.db.config.auth.server == 'default': self.settings.mailer = Mailer(self.db) else: self.settings.mailer.server = self.db.config.auth.server self.settings.mailer.sender = self.db.config.auth.sender self.settings.mailer.login = self.db.config.auth.login
def __init__(self, db): self.db = db self.hmac_key = Auth.get_or_create_key() Auth.__init__(self, self.db, hmac_key=self.hmac_key) #self.settings.logout_onlogout = lambda user: self.remove_session(user) #self.settings.register_onaccept = lambda form: add_to_users_group(form) self.settings.register_onaccept = [lambda form: self.send_welcome_email(form.vars), lambda form: self.initial_user_permission(form.vars)] #self.settings.login_onaccept = [lambda form: self.initial_user_permission(form.vars)] #self.settings.profile_onvalidation = [] self.settings.profile_onaccept = [lambda form: self.remove_facebook_google_alert(form)] # remove facebook / google alert session #self.settings.change_password_onaccept = [] # send alert email self.settings.controller = 'person' self.settings.allow_basic_login = True self.settings.register_verify_password = True self.settings.login_url = self.url('account', args='login') self.settings.verify_email_next = self.url('account', args='login') self.settings.logged_url = self.url('account', args='profile') self.settings.login_next = self.db.CURL('person', 'show') self.settings.register_next = self.db.CURL('person', 'show') self.settings.profile_next = self.db.CURL('person', 'account', args='profile') self.settings.retrieve_username_next = self.url('account', args='login') self.settings.retrieve_password_next = self.url('account', args='login') self.settings.request_reset_password_next = self.url('account', args='login') self.settings.reset_password_next = self.url('account', args='login') self.settings.change_password_next = self.db.CURL('person', 'show') self.messages.verify_email = \ 'Click on the link http://' + self.db.request.env.http_host + \ self.db.CURL('person', 'account', args=['verify_email']) + \ '/%(key)s to verify your email' self.messages.reset_password = \ 'Click on the link http://' + self.db.request.env.http_host + \ self.db.CURL('person', 'account', args=['reset_password']) + \ '/%(key)s to reset your password' self.settings.on_failed_authorization = self.url('account', args='not_authorized') self.settings.formstyle = 'divs' self.settings.label_separator = '' self.settings.register_next = self.url('show') self.settings.registration_requires_verification = self.db.config.auth.registration_requires_verification self.settings.registration_requires_approval = self.db.config.auth.registration_requires_approval if 'register' in self.db.request.args and self.db.config.auth.use_recaptcha: from gluon.tools import Recaptcha recaptcha_options = dict(self.db.config.get_list('auth', 'recaptcha')) self.settings.captcha = Recaptcha(self.db.request, recaptcha_options['public'], recaptcha_options['private'], options="theme:'%(theme)s', lang:'%(lang)s'" % recaptcha_options) from datamodel.user import User user = User(self) self.entity = user.entity if self.db.config.auth.server == 'default': self.settings.mailer = Mailer(self.db) else: self.settings.mailer.server = self.db.config.auth.server self.settings.mailer.sender = self.db.config.auth.sender self.settings.mailer.login = self.db.config.auth.login
def __init__(self, file, globals, db, mail): ''' Inicio de variables globales que pertenecen al framework''' Auth.__init__(self, globals, db) datos = ConvertXmlToDict(file) self.config = datos.config_var self.globals = globals self.db = db self.mail = mail self.setMessa()
def __init__(self, db): self.db = db self.hmac_key = Auth.get_or_create_key() Auth.__init__(self, self.db, hmac_key=self.hmac_key) user = User(self) self.entity = user.entity # READ AUTH CONFIGURATION FROM CONFIG self.settings.formstyle = self.db.config.auth.formstyle if self.db.config.auth.server == "default": self.settings.mailer = Mailer(self.db.config) else: self.settings.mailer.server = self.db.config.auth.server self.settings.mailer.sender = self.db.config.auth.sender self.settings.mailer.login = self.db.config.auth.login
def __init__(self, environment, deployment_settings, db=None): """ Initialise parent class & make any necessary modifications """ Auth.__init__(self, environment, db) self.deployment_settings = deployment_settings self.session = self.environment.session self.settings.lock_keys = False self.settings.username_field = False self.settings.lock_keys = True self.messages.lock_keys = False self.messages.email_sent = 'Verification Email sent - please check your email to validate. If you do not receive this email please check you junk email or spam filters' self.messages.email_verified = 'Email verified - you can now login' self.messages.registration_disabled = "Registration Disabled!" self.messages.lock_keys = True
def __init__(self, environment, p, db=None, migrate=True): Auth.__init__(self, environment, db) global T T = p self.messages.invalid_login = T("We're sorry. " + \ "The email or password you entered didn't match our records. " + \ "Please try again.") self.messages.lock_keys = False self.messages.disabled_login = T('Sorry. Your account has been disabled. Please contact support.') self.messages.lock_keys = True self.settings.table_user = db.define_table( self.settings.table_user_name, db.Field('first_name', length=128,default=''), db.Field('last_name', length=128,default=''), db.Field('email', length=128,default='',unique=True), db.Field('twitter_id', length=128,default=None,unique=True), db.Field('facebook_id', length=128,default=None,unique=True), db.Field('password', 'password', readable=False), db.Field('marketing', 'boolean', default=False), db.Field('zipcode', 'integer'), db.Field('birthday', 'date'), db.Field('registration_key', length=128, writable=False, readable=False,default=''), migrate=migrate) table = self.settings.table_user table.first_name.requires = IS_NOT_EMPTY() table.last_name.requires = IS_NOT_EMPTY() table.password.requires = [IS_LENGTH(minsize=6, error_message="We're sorry. Please " + \ "enter a password with at least six " + \ "characters."), CRYPT()] table.email.requires = [IS_EMAIL(error_message=T("Please enter a valid email address.")), IS_NOT_IN_DB(db, '%s.email' % self.settings.table_user._tablename, error_message=T("We're sorry. " + \ "That email address already exists in our system. " + \ "Please login or choose another email address."))] table.zipcode.requires = IS_NULL_OR(IS_INT_IN_RANGE(1, 99999, error_message=T("Invalid Zip Code"))) table.birthday.requires=IS_NULL_OR(IS_DATE(format=T('%Y-%m-%d'), error_message=T('must be YYYY-MM-DD!'))) table.registration_key.default = ''
def __init__(self, db, controller, function): self.db = db Auth.__init__(self, db=db, controller=controller, function=function)
def __init__(self, db): self.db = db self.hmac_key = Auth.get_or_create_key() Auth.__init__(self, self.db, hmac_key=self.hmac_key) # self.settings.logout_onlogout = lambda user: self.remove_session(user) # self.settings.register_onaccept = lambda form: add_to_users_group(form) self.settings.register_onaccept = [ lambda form: self.send_welcome_email(form.vars), lambda form: self.initial_user_permission(form.vars), ] # self.settings.login_onaccept = [lambda form: self.initial_user_permission(form.vars)] # self.settings.profile_onvalidation = [] self.settings.profile_onaccept = [ lambda form: self.remove_facebook_google_alert(form) ] # remove facebook / google alert session # self.settings.change_password_onaccept = [] # send alert email self.settings.controller = "person" self.settings.allow_basic_login = True self.settings.register_verify_password = True self.settings.login_url = self.url("account", args="login") self.settings.verify_email_next = self.url("account", args="login") self.settings.logged_url = self.url("account", args="profile") self.settings.login_next = self.db.CURL("person", "show") self.settings.register_next = self.db.CURL("person", "show") self.settings.profile_next = self.db.CURL("person", "account", args="profile") self.settings.retrieve_username_next = self.url("account", args="login") self.settings.retrieve_password_next = self.url("account", args="login") self.settings.request_reset_password_next = self.url("account", args="login") self.settings.reset_password_next = self.url("account", args="login") self.settings.change_password_next = self.db.CURL("person", "show") self.messages.verify_email = ( "Click on the link http://" + self.db.request.env.http_host + self.db.CURL("person", "account", args=["verify_email"]) + "/%(key)s to verify your email" ) self.messages.reset_password = ( "Click on the link http://" + self.db.request.env.http_host + self.db.CURL("person", "account", args=["reset_password"]) + "/%(key)s to reset your password" ) self.settings.on_failed_authorization = self.url("account", args="not_authorized") self.settings.formstyle = "divs" self.settings.label_separator = "" self.settings.register_next = self.url("show") self.settings.registration_requires_verification = self.db.config.auth.registration_requires_verification self.settings.registration_requires_approval = self.db.config.auth.registration_requires_approval if "register" in self.db.request.args and self.db.config.auth.use_recaptcha: from gluon.tools import Recaptcha recaptcha_options = dict(self.db.config.get_list("auth", "recaptcha")) self.settings.captcha = Recaptcha( self.db.request, recaptcha_options["public"], recaptcha_options["private"], options="theme:'%(theme)s', lang:'%(lang)s'" % recaptcha_options, ) from datamodel.user import User user = User(self) self.entity = user.entity if self.db.config.auth.server == "default": self.settings.mailer = Mailer(self.db) else: self.settings.mailer.server = self.db.config.auth.server self.settings.mailer.sender = self.db.config.auth.sender self.settings.mailer.login = self.db.config.auth.login
def __init__(self, environment): Auth.__init__(self, environment, db=None, controller='plugin_social_auth') self.messages.update(confirm=self.__default_confirm_message)
def __init__(self, db): self.db = db Auth.__init__(self, self.db) user = User(self) self.entity = user.entity