Esempio n. 1
0
def deauth():
    count = 0
    if request.form.has_key("token"):
        token = request.form["token"]
        c = sqlite_connect()
        cur = c.cursor()
        cur.execute("DELETE FROM auth WHERE token=?", (token,))
        c.commit()
        count = c.total_changes

    if app.debug:
        return helpers.deauth_debug_response(count)
    else:
        return '',200
Esempio n. 2
0
def get_registrations():
    conn = helpers.sqlite_connect()
    cur = conn.cursor()
    cur.execute("SELECT * FROM registrations")
    return list(cur)
Esempio n. 3
0
import sys

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/../")

import lib.helpers as helpers
import csv


TARGET_FILENAME = "users.csv"

if __name__ == "__main__":
    if os.path.exists(TARGET_FILENAME):
        print TARGET_FILENAME,"exists, exiting!"
        exit(1)
    else:
        conn = helpers.sqlite_connect()
        cur  = conn.cursor()
        ids = set()
        details = []

        for row in cur.execute("SELECT * FROM registrations WHERE processed='0'"):
            details.append(row)
            ids.add(row[0])

        # Make created files have no 'group' or 'other' access.
        os.umask(0177)

        with open(TARGET_FILENAME, "w") as csvfile:
            writer = csv.writer(csvfile)
            for row in details:
                row = list(row)
Esempio n. 4
0
def delete_db():
    conn = helpers.sqlite_connect()
    cur = conn.cursor()
    cur.execute("DELETE FROM registrations")
    conn.commit()