Skip to content

Commit

Permalink
release v2.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Oct 31, 2024
1 parent d747b62 commit dcf3b9b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CyberCP/secMiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ def __call__(self, request):
try:
uID = request.session['userID']
admin = Administrator.objects.get(pk=uID)
ipAddr = get_client_ip(request)
ipAddr = secMiddleware.get_client_ip(request)

if ipAddr.find('.') > -1:
if request.session['ipAddr'] == ipAddr or admin.securityLevel == secMiddleware.LOW:
pass
else:
del request.session['userID']
del request.session['ipAddr']
logging.writeToFile(get_client_ip(request))
logging.writeToFile(secMiddleware.get_client_ip(request))
final_dic = {'error_message': "Session reuse detected, IPAddress logged.",
"errorMessage": "Session reuse detected, IPAddress logged."}
final_json = json.dumps(final_dic)
return HttpResponse(final_json)
else:
ipAddr = get_client_ip(request).split(':')[:3]
ipAddr = secMiddleware.get_client_ip(request).split(':')[:3]
if request.session['ipAddr'] == ipAddr or admin.securityLevel == secMiddleware.LOW:
pass
else:
del request.session['userID']
del request.session['ipAddr']
logging.writeToFile(get_client_ip(request))
logging.writeToFile(secMiddleware.get_client_ip(request))
final_dic = {'error_message': "Session reuse detected, IPAddress logged.",
"errorMessage": "Session reuse detected, IPAddress logged."}
final_json = json.dumps(final_dic)
Expand Down

0 comments on commit dcf3b9b

Please sign in to comment.