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)
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()
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