Revision 09e7393c snf-astakos-app/astakos/im/target/redirect.py
b/snf-astakos-app/astakos/im/target/redirect.py | ||
---|---|---|
43 | 43 |
from urlparse import urlunsplit, urlsplit, urlparse, parse_qsl |
44 | 44 |
|
45 | 45 |
from astakos.im.settings import COOKIE_NAME, COOKIE_DOMAIN |
46 |
from astakos.im.util import set_cookie, has_signed_terms
|
|
46 |
from astakos.im.util import set_cookie |
|
47 | 47 |
|
48 | 48 |
import logging |
49 | 49 |
|
... | ... | |
51 | 51 |
|
52 | 52 |
def login(request): |
53 | 53 |
""" |
54 |
If there is no `next` request parameter redirects to astakos index page displaying an error |
|
55 |
message. |
|
56 |
If the request user is authenticated and has signed the approval terms, redirects to `next` request parameter. If not, redirects to approval terms in order to return back here after agreeing with the terms. |
|
54 |
If there is no ``next`` request parameter redirects to astakos index page |
|
55 |
displaying an error message. |
|
56 |
If the request user is authenticated and has signed the approval terms, |
|
57 |
redirects to `next` request parameter. If not, redirects to approval terms |
|
58 |
in order to return back here after agreeing with the terms. |
|
57 | 59 |
Otherwise, redirects to login in order to return back here after successful login. |
58 | 60 |
""" |
59 | 61 |
next = request.GET.get('next') |
... | ... | |
67 | 69 |
if request.user.is_authenticated(): |
68 | 70 |
# if user has not signed the approval terms |
69 | 71 |
# redirect to approval terms with next the request path |
70 |
if not has_signed_terms(request.user):
|
|
72 |
if not request.user.signed_terms():
|
|
71 | 73 |
# first build next parameter |
72 | 74 |
parts = list(urlsplit(request.build_absolute_uri())) |
73 | 75 |
params = dict(parse_qsl(parts[3], keep_blank_values=True)) |
Also available in: Unified diff