Example #1
0
         sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))
     if has_poll:
         req_params = [evcommon.POST_MID_POLL, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             result = mid.poll()
         else:
             evlog.log_error(logline)
     else:
         req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             cgilog.do_log("vote/auth")
             result = mid.init_sign(form)
         else:
             cgilog.do_log_error('vote/auth/err')
             evlog.log_error(logline)
 else:
     req_params = [evcommon.POST_PHONENO]
     res, logline = cgivalidator.validate_form(form, req_params)
     if res:
         cgilog.do_log("cand/auth")
         phoneno = form.getvalue(evcommon.POST_PHONENO)
         evlog.log("PHONENO: " + phoneno)
         if election.Election().allow_new_voters():
             result = mid.init_auth(phoneno)
         else:
             a, b = protocol.plain_error_election_off_after()
             result = protocol.msg_error(a, b)
     else:
         cgilog.do_log_error('cand/auth/err')
Example #2
0
    result = protocol.msg_error_technical()
    evlog.AppLog().set_app('HES')

    try:
        if form.has_key(evcommon.POST_EVOTE):
            req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]

            if cgivalidator.validate_sessionid(form):
                sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))

            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('vote/auth')
                result = hesd.hts_vote(form.getvalue(evcommon.POST_EVOTE))
            else:
                cgilog.do_log_error('vote/auth/err')
                evlog.log_error(logline)
        else:
            req_params = []
            res, logline = cgivalidator.validate_form(form, req_params)
            if res:
                cgilog.do_log('cand/auth')
                if election.Election().allow_new_voters():
                    result = hesd.get_candidate_list()
                else:
                    evlog.log_error('nonewvoters')
                    a, b = protocol.plain_error_election_off_after()
                    result = protocol.msg_error(a, b)
            else:
                cgilog.do_log_error('cand/auth/err')
                evlog.log_error(logline)
Example #3
0
    evlog.AppLog().set_app("VERIFY")

    try:
        req_params = [evcommon.POST_VERIFY_VOTE]
        res, logline = cgivalidator.validate_form(form, req_params)
        if res:
            cgilog.do_log("verif/auth")
            elec = election.Election()
            params = ((evcommon.POST_SESS_ID, sessionid.voting()),
                      (evcommon.POST_VERIFY_VOTE,
                       form.getvalue(evcommon.POST_VERIFY_VOTE)))

            evlog.log("verif/auth VOTE-ID: " +
                      urllib.quote_plus(params[1][1])[:200])

            url = ("http://" + elec.get_hts_ip() + "/" +
                   elec.get_hts_verify_path())
            conn = urllib.urlopen(url, urllib.urlencode(params))
            result = conn.read()
        else:
            cgilog.do_log_error("verif/err")
            evlog.log_error(logline)
    except:
        evlog.log_exception()
        result = protocol.msg_error_technical()

    protocol.http_response(result)
    cgi.sys.exit(0)

# vim:set ts=4 sw=4 et fileencoding=utf8:
    evlog.AppLog().set_app("VERIFY")

    try:
        req_params = [evcommon.POST_VERIFY_VOTE]
        res, logline = cgivalidator.validate_form(form, req_params)
        if res:
            cgilog.do_log("verif/auth")
            elec = election.Election()
            params = ((evcommon.POST_SESS_ID, sessionid.voting()),
                      (evcommon.POST_VERIFY_VOTE,
                       form.getvalue(evcommon.POST_VERIFY_VOTE)))

            evlog.log("verif/auth VOTE-ID: " +
                      urllib.quote_plus(params[1][1])[:200])

            url = ("http://" + elec.get_hts_ip() + "/" +
                   elec.get_hts_verify_path())
            conn = urllib.urlopen(url, urllib.urlencode(params))
            result = conn.read()
        else:
            cgilog.do_log_error("verif/err")
            evlog.log_error(logline)
    except:
        evlog.log_exception()
        result = protocol.msg_error_technical()

    protocol.http_response(result)
    cgi.sys.exit(0)

# vim:set ts=4 sw=4 et fileencoding=utf8:
Example #5
0
         sessionid.setsid(form.getvalue(evcommon.POST_SESS_ID))
     if has_poll:
         req_params = [evcommon.POST_MID_POLL, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             result = mid.poll(form)
         else:
             evlog.log_error(logline)
     else:
         req_params = [evcommon.POST_EVOTE, evcommon.POST_SESS_ID]
         res, logline = cgivalidator.validate_form(form, req_params)
         if res:
             cgilog.do_log("vote/auth")
             result = mid.init_sign(form)
         else:
             cgilog.do_log_error("vote/auth/err")
             evlog.log_error(logline)
 else:
     req_params = [evcommon.POST_PHONENO]
     res, logline = cgivalidator.validate_form(form, req_params)
     if res:
         cgilog.do_log("cand/auth")
         phoneno = form.getvalue(evcommon.POST_PHONENO)
         evlog.log("PHONENO: " + phoneno)
         if election.Election().allow_new_voters():
             result = mid.init_auth(phoneno)
         else:
             evlog.log_error("nonewvoters")
             a, b = protocol.plain_error_election_off_after()
             result = protocol.msg_error(a, b)
     else: