from myslice.theme import ThemeView
+from portal.account import Account, get_expiration
#
-import json, os, re, itertools
+import json, os, re, itertools, time
from OpenSSL import crypto
from Crypto.PublicKey import RSA
if acc_user_cred == {} or acc_user_cred == 'N/A':
user_cred = 'no_creds'
else:
- user_cred = 'has_creds'
+ exp_date = get_expiration(acc_user_cred, 'timestamp')
+ if exp_date < time.time():
+ user_cred = 'creds_expired'
+ else:
+ user_cred = 'has_creds'
context = super(AccountView, self).get_context_data(**kwargs)
context['principal_acc'] = principal_acc_list
platform_query = Query().get('local:platform').select('platform_id','platform')
platform_details = execute_query(request, platform_query)
- # getting the user_id from the session
- for user_detail in user_details:
- user_id = user_detail['user_id']
- user_email = user_detail['email']
+ # getting the user_id from the session
+ for user_detail in user_details:
+ user_id = user_detail['user_id']
+ user_email = user_detail['email']
+ try:
+ if user_email == request.user.email:
+ authorize_query = True
+ else:
+ print "SECURITY: %s tried to update %s" % (user_email, request.user.email)
+ messages.error(request, 'You are not authorized to modify another user.')
+ return HttpResponseRedirect("/portal/account/")
+ except Exception,e:
+ print "Exception = %s" % e
for account_detail in account_details:
for platform_detail in platform_details: