예제 #1
0
def manage(req):
    from identity import Identity
    import commvals
    import status
    import hashlib

    s = status.Status()
    t = Identity()
    resp = dict()
    if req.POST:
        passwd = req.POST.get('password')
        if hashlib.md5(passwd.encode('utf-8')).hexdigest() == commvals.SERVER_PASSWORD:
            t.ids.append(req.META.get('REMOTE_ADDR'))
            resp.update({'identity': True})
        else:
            resp.update({'identity': False})
    else:
        if t.identity(req.META.get('REMOTE_ADDR')):
            resp.update({'identity': True})
        else:
            resp.update({'identity': False})
    return render_to_response('manage.html', resp)