def logged_in(self): controller = UserController() if not c.user: # a number of failed login attempts greater than 10 # indicates that the locked user is associated with the current request qgovUser = Session.query(QGOVUser).filter(QGOVUser.login_attempts > 10).first() if qgovUser: qgovUser.login_attempts = 10 Session.commit() return controller.login("account-locked") return controller.logged_in()
def logged_in(self): controller = UserController() if not c.user: # a number of failed login attempts greater than 10 # indicates that the locked user is associated with the current request seedUser = Session.query(SEEDUser).filter( SEEDUser.login_attempts > 10).first() if seedUser: seedUser.login_attempts = 10 Session.commit() return controller.login('account-locked') return controller.logged_in()
def logged_in(self): #log.debug("insde-------------------") controller = UserController() if not c.user: # a number of failed login attempts greater than 10 # indicates that the locked user is associated with the current request seedUser = Session.query(SEEDUser).filter( SEEDUser.login_attempts > 5).first() if seedUser: seedUser.login_attempts = 5 Session.commit() return controller.login( 'Login Failed: Bad username or password') return controller.logged_in()
def logged_in(self): # we need to set the language via a redirect # Lang is not being retrieved properly by the Babel i18n lib in # this redirect, so using this clunky workaround for now. lang = session.pop('lang', None) if lang is None: came_from = request.params.get('came_from', '') if came_from.startswith('/fr'): lang = 'fr' else: lang = 'en' session.save() # we need to set the language explicitly here or the flash # messages will not be translated. i18n.set_lang(lang) if c.user: context = None data_dict = {'id': c.user} user_dict = get_action('user_show')(context, data_dict) h.flash_success( _('<strong>Note</strong><br>{0} is now logged in').format( user_dict['display_name']), allow_html=True) notice_no_access() return h.redirect_to( controller='ckanext.canada.controller:CanadaController', action='home', locale=lang) else: error_summary = _('Login failed. Bad username or password.') # replace redirect with a direct call to login controller # pass error_summary to controller as error # so that it can be captured for GA events in our overridden templates return UserController.login(self, error_summary)