Oct 18, 2019
22 Views
Comments Off on Fixing error login logout Cyberpanel”: “Session reuse detected, IPAddress logged

Fixing error login logout Cyberpanel”: “Session reuse detected, IPAddress logged

Written by

If your IP change frequently and you don’t need this protection, you can edit this file

On server this file is available at /usr/local/CyberCP/CyberCP

then systemctl restart lscpd

    try:
            uID = request.session['userID']
            ipAddr = request.META.get('REMOTE_ADDR')

            if ipAddr.find('.') > -1:
                if request.session['ipAddr'] == ipAddr:
                    pass
                else:
                    del request.session['userID']
                    del request.session['ipAddr']
                    logging.writeToFile(request.META.get('REMOTE_ADDR'))
                    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 = request.META.get('REMOTE_ADDR').split(':')[:3]

                if request.session['ipAddr'] == ipAddr:
                    pass
                else:
                    del request.session['userID']
                    del request.session['ipAddr']
                    logging.writeToFile(request.META.get('REMOTE_ADDR'))
                    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)
        except:
            pass
Article Categories:
Code/Web
    http://linholiver.com

    https://linholiver.com/diary/about/

    Comments are closed.