Revision 09e7393c snf-astakos-app/astakos/im/api.py
b/snf-astakos-app/astakos/im/api.py | ||
---|---|---|
48 | 48 |
from astakos.im.faults import BadRequest, Unauthorized, InternalServerError, Fault |
49 | 49 |
from astakos.im.models import AstakosUser |
50 | 50 |
from astakos.im.settings import CLOUD_SERVICES, INVITATIONS_ENABLED, COOKIE_NAME |
51 |
from astakos.im.util import has_signed_terms, epoch
|
|
51 |
from astakos.im.util import epoch |
|
52 | 52 |
|
53 | 53 |
logger = logging.getLogger(__name__) |
54 | 54 |
|
... | ... | |
112 | 112 |
if (time() - mktime(user.auth_token_expires.timetuple())) > 0: |
113 | 113 |
raise Unauthorized('Authentication expired') |
114 | 114 |
|
115 |
if not has_signed_terms(user):
|
|
115 |
if not user.signed_terms():
|
|
116 | 116 |
raise Unauthorized('Pending approval terms') |
117 | 117 |
|
118 | 118 |
response = HttpResponse() |
... | ... | |
123 | 123 |
'auth_token_created':user.auth_token_created.isoformat(), |
124 | 124 |
'auth_token_expires':user.auth_token_expires.isoformat(), |
125 | 125 |
'has_credits':user.has_credits, |
126 |
'has_signed_terms':has_signed_terms(user)}
|
|
126 |
'has_signed_terms':user.signed_terms()}
|
|
127 | 127 |
response.content = json.dumps(user_info) |
128 | 128 |
response['Content-Type'] = 'application/json; charset=UTF-8' |
129 | 129 |
response['Content-Length'] = len(response.content) |
... | ... | |
146 | 146 |
if (time() - mktime(user.auth_token_expires.timetuple())) > 0: |
147 | 147 |
raise Unauthorized('Authentication expired') |
148 | 148 |
|
149 |
if not has_signed_terms(user):
|
|
149 |
if not user.signed_terms():
|
|
150 | 150 |
raise Unauthorized('Pending approval terms') |
151 | 151 |
|
152 | 152 |
response = HttpResponse() |
Also available in: Unified diff