Пример #1
0
    def list(self):
        """ List the user accounts in the system"""
        user_list = UserMgr.get_list()
        log.debug(user_list)
        tpl.user_list = user_list

        return render('/account/list.mako')
Пример #2
0
    def new(self):
        """Add a new user to the auth system

        """
        tpl.group_list = GroupMgr.get_list()
        tpl.form_errors = False
        return render('/account/new.mako')
Пример #3
0
    def login(self):
        """This is where the login form should be rendered."""
        if auth.check(not_anonymous()):
            # if we're not anonymous then we're logged in and need to be
            # redirected
            log.debug('already logged in')
            redirect(url('/page/test'))

        # Without the login counter, we won't be able to tell if the user has
        # tried to log in with the wrong credentials
        if 'repoze.who.logins' in request.environ:
            login_counter = request.environ['repoze.who.logins']
        else:
            login_counter = 0

        if login_counter > 0:
            log.debug('Wrong Login credentials')
            #flash('Wrong credentials')
        tpl.login_counter = login_counter
        tpl.came_from = request.params.get('came_from') or url('/')

        if 'login_failed' in request.params:
            tpl.login_failed = True
        else:
            tpl.login_failed = False
        return render('/login.mako')
Пример #4
0
    def list(self):
        """ List the user accounts in the system"""
        user_list = UserMgr.get_list()
        log.debug(user_list)
        tpl.user_list = user_list

        return render('/account/list.mako')
Пример #5
0
    def login(self):
        """This is where the login form should be rendered."""
        if auth.check(not_anonymous()):
            # if we're not anonymous then we're logged in and need to be
            # redirected
            log.debug('already logged in')
            redirect(url('/page/test'))

        # Without the login counter, we won't be able to tell if the user has
        # tried to log in with the wrong credentials
        if 'repoze.who.logins' in request.environ:
            login_counter = request.environ['repoze.who.logins']
        else:
            login_counter = 0

        if login_counter > 0:
            log.debug('Wrong Login credentials')
            #flash('Wrong credentials')
        tpl.login_counter = login_counter
        tpl.came_from = request.params.get('came_from') or url('/')

        if 'login_failed' in request.params:
            tpl.login_failed = True
        else:
            tpl.login_failed = False
        return render('/login.mako')
Пример #6
0
    def new(self):
        """Add a new user to the auth system

        """
        tpl.group_list = GroupMgr.get_list()
        tpl.form_errors = False
        return render('/account/new.mako')
Пример #7
0
    def edit(self, user_name):
        """Load the edit ui for this user"""
        tpl.user = UserMgr.get(user_name=user_name)
        tpl.group_list = GroupMgr.get_list()

        tpl.form_errors = False
        for g in tpl.group_list:
            if g in tpl.user.groups:
                log.debug("IN GROUP")
            else:
                log.debug("NOT IN GROUP")

        self.json.success = True
        return render('/account/edit.mako')
Пример #8
0
    def edit(self, user_name):
        """Load the edit ui for this user"""
        tpl.user = UserMgr.get(user_name=user_name)
        tpl.group_list = GroupMgr.get_list()

        tpl.form_errors = False
        for g in tpl.group_list:
            if g in tpl.user.groups:
                log.debug("IN GROUP")
            else:
                log.debug("NOT IN GROUP")

        self.json.success = True
        return render('/account/edit.mako')