Ejemplo n.º 1
0
    def login(self, error=None):
        '''
        Code copied from controllers/user.py:345
        :param error:
        :return:
        '''
        # Do any plugin login stuff
        for item in p.PluginImplementations(p.IAuthenticator):
            item.login()

        if 'error' in request.params:
            h.flash_error(request.params['error'])

        if not c.user:
            came_from = request.params.get('came_from')
            if not came_from:
                came_from = h.url_for(controller='user', action='logged_in')
            c.login_handler = h.url_for(
                self._get_repoze_handler('login_handler_path'),
                came_from=came_from)
            if error:
                # vars = {'error_summary': {'': error}}
                template_data = ue_helpers.get_login(False, error)
            else:
                template_data = {}

            return render('home/index.html', extra_vars=template_data)
            # return render('user/login.html', extra_vars=vars)
            # return OnbLoginErr
        else:
            return render('user/logout_first.html')
Ejemplo n.º 2
0
 def new_login(self, error=None, info_message=None, page_subtitle=None):
     template_data = {}
     if not c.user:
         template_data = ue_helpers.get_login(True, "")
     if info_message:
         if 'data' not in template_data:
             template_data['data'] = {}
         template_data['data']['info_message'] = info_message
         template_data['data']['page_subtitle'] = page_subtitle
     return render('home/index.html', extra_vars=template_data)
Ejemplo n.º 3
0
            try:
                if g.openid_enabled:
                    err += _(
                        ' (Or if using OpenID, it hasn\'t been associated '
                        'with a user account.)')
            except:
                pass

            if p.toolkit.asbool(config.get('ckan.legacy_templates', 'false')):
                h.flash_error(err)
                h.redirect_to(controller='user',
                              action='login',
                              came_from=came_from)

            else:
                template_data = ue_helpers.get_login(False, err)
                log.error("Status code 401 : username or password incorrect")
                return render('home/index.html', extra_vars=template_data)
                # return self.login(error=err)

    def logged_out_page(self):
        template_data = ue_helpers.get_logout(
            True, _('User logged out with success'))
        return render('home/index.html', extra_vars=template_data)
        # return render('user/logout.html')

    def register_email(self, data=None, errors=None, error_summary=None):

        data_dict = logic.clean_dict(
            unflatten(logic.tuplize_dict(logic.parse_params(request.params))))