Commit 56d2b3c2bc0293d94837c60b0234c1342fc3f995
1 parent
84599d97
Exists in
master
and in
3 other branches
Login next param redirect and log
Showing
1 changed file
with
11 additions
and
1 deletions
Show diff stats
users/views.py
... | ... | @@ -11,6 +11,8 @@ from braces import views as braces_mixins |
11 | 11 | |
12 | 12 | from security.models import Security |
13 | 13 | |
14 | +from log.decorators import log_decorator | |
15 | + | |
14 | 16 | from .models import User |
15 | 17 | from .utils import has_dependencies |
16 | 18 | from .forms import RegisterUserForm, ProfileForm, UserForm, ChangePassForm, PassResetRequest, SetPasswordForm |
... | ... | @@ -436,7 +438,7 @@ class PasswordResetConfirmView(generic.FormView): |
436 | 438 | messages.error(request, _('The reset password link is no longer valid.')) |
437 | 439 | return self.form_invalid(form) |
438 | 440 | |
439 | - | |
441 | +@log_decorator('user', 'access', 'system') | |
440 | 442 | def login(request): |
441 | 443 | context = {} |
442 | 444 | context['title'] = _('Log In') |
... | ... | @@ -452,6 +454,14 @@ def login(request): |
452 | 454 | if user is not None: |
453 | 455 | if not security.maintence or user.is_staff: |
454 | 456 | login_user(request, user) |
457 | + | |
458 | + next_url = request.GET.get('next', None) | |
459 | + | |
460 | + request.log_context = {} | |
461 | + | |
462 | + if next_url: | |
463 | + return redirect(next_url) | |
464 | + | |
455 | 465 | return redirect(reverse("home")) |
456 | 466 | else: |
457 | 467 | messages.error(request, _('System under maintenance. Try again later')) | ... | ... |