コード例 #1
0
ファイル: login.py プロジェクト: alvabai/trac-multiproject
    def process_request(self, req):
        """
        Process log(in/out) requests
        """
        act = req.args.get('action')

        if not act:
            referer = safe_address(self.env, req.get_header('Referer'))
            if referer:
                self._set_goto(req, referer)
            else:
                self._set_goto(req, req.args.get('goto'))
        else:
            self._set_goto(req, req.args.get('goto'))

        actions = {
            'login':self._show_login,
            'do_login':self._do_login,
            'logout':self._do_logout,
            'approve':self._do_approve
        }

        if actions.has_key(act):
            return actions[act](req)

        # Already logged in
        if req.authname != 'anonymous':
            req.redirect(self.env.home_href())

        return self._show_login(req)
コード例 #2
0
ファイル: login.py プロジェクト: alvabai/trac-multiproject
    def _set_goto(self, req, goto):
        """ Sets goto parameter into session
        """
        safegoto = safe_address(self.env, goto)

        if safegoto:
            req.session['goto'] = safegoto
            req.session.save()
コード例 #3
0
ファイル: actions.py プロジェクト: alvabai/trac-multiproject
 def remove_failure(self, req, project=None):
     backurl = req.args.get('goto')
     backurl = safe_address(self.env, backurl) or ProjectListModule.home()
     if not 'TRAC_ADMIN' in req.perm:
         req.redirect(backurl)
     data = {
         'env_name': req.args.get('project'),
         'project': project,
         'goto': backurl
     }
     return 'project_remove_form.html', data, None
コード例 #4
0
 def remove_failure(self, req, project=None):
     backurl = req.args.get('goto')
     backurl = safe_address(self.env, backurl) or ProjectListModule.home()
     if not 'TRAC_ADMIN' in req.perm:
         req.redirect(backurl)
     data = {
         'env_name': req.args.get('project'),
         'project': project,
         'goto': backurl
     }
     return 'project_remove_form.html', data, None