Show More
@@ -42,6 +42,8 b' class LoginController(BaseController):' | |||
|
42 | 42 | |
|
43 | 43 | def index(self): |
|
44 | 44 | #redirect if already logged in |
|
45 | c.came_from = request.GET.get('came_from',None) | |
|
46 | ||
|
45 | 47 | if c.hg_app_user.is_authenticated: |
|
46 | 48 | return redirect(url('hg_home')) |
|
47 | 49 | |
@@ -50,7 +52,10 b' class LoginController(BaseController):' | |||
|
50 | 52 | login_form = LoginForm() |
|
51 | 53 | try: |
|
52 | 54 | c.form_result = login_form.to_python(dict(request.POST)) |
|
53 | return redirect(url('hg_home')) | |
|
55 | if c.came_from: | |
|
56 | return redirect(c.came_from) | |
|
57 | else: | |
|
58 | return redirect(url('hg_home')) | |
|
54 | 59 | |
|
55 | 60 | except formencode.Invalid as errors: |
|
56 | 61 | return htmlfill.render( |
@@ -228,8 +228,12 b' class LoginRequired(object):' | |||
|
228 | 228 | return func(*fargs, **fkwargs) |
|
229 | 229 | else: |
|
230 | 230 | log.warn('user %s not authenticated', user.username) |
|
231 | log.debug('redirecting to login page') | |
|
232 | return redirect(url('login_home')) | |
|
231 | ||
|
232 | p = request.environ.get('PATH_INFO') | |
|
233 | if request.environ.get('QUERY_STRING'): | |
|
234 | p+='?'+request.environ.get('QUERY_STRING') | |
|
235 | log.debug('redirecting to login page with %',p) | |
|
236 | return redirect(url('login_home',came_from=p)) | |
|
233 | 237 | |
|
234 | 238 | class PermsDecorator(object): |
|
235 | 239 | """Base class for decorators""" |
General Comments 0
You need to be logged in to leave comments.
Login now