def broadcast_user_list(cursor):
    print("send users")
    io.emit('userlist', [{
        "name": u.name,
        "rowid": u.rowid,
        "status": get_user_status(u.rowid),
    } for u in UserForLogin.getAll(cursor)],
            broadcast=True)
    print("users sent")
    for u in UserForLogin.getAll(cursor):
        print(u.name)
示例#2
0
def broadcast_user_list(cursor):
    io.emit('userlist', [{
        "name": u.name,
        "rowid": u.rowid,
        "status": get_user_status(u.rowid),
    } for u in UserForLogin.getAll(cursor)],
            broadcast=True)
def is_email_used(email):
    db = get_db()
    cur = db.cursor()

    user = UserForLogin.getByEmail(cur, email)
    free = user is None

    return jsonify({"email": email, "free": free})
def ShowWork():
    id_ta = request.form['idWork']
    db = get_db()
    cur = db.cursor()

    cur.execute(
        '''SELECT * FROM tasks,column where tasks.column_id=column.rowid''')
    tasks = cur.fetchall()

    return render_template(
        'index.html',
        users=UserForLogin.getAll(cur),
        columns=columns,
        tasks=tasks,
        works=WorkForDisplay.getAll(cur),
    )
示例#5
0
def login_post():
    email = request.form.get('email')
    password = request.form.get('password')
    remember = request.form.get('remember_me')

    db = get_db()
    cur = db.cursor()

    user = UserForLogin.getByEmail(cur, email)
    if user is None or not user.check_password(password):
        return render_template(
            'login.html',
            error_msg="Authentication failed",
        )

    flask_login.login_user(user, remember=remember)
    return redirect(url_for('home'))
def home():
    db = get_db()
    cur = db.cursor()

    cur.execute('''SELECT rowid,* FROM column''')
    columns = cur.fetchall()

    cur.execute(
        '''SELECT * FROM tasks,column where tasks.column_id=column.rowid''')
    tasks = cur.fetchall()

    cur.execute(
        '''SELECT rowid, * FROM work where creator_id=? ORDER BY work.timestamp DESC''',
        (flask_login.current_user.get_id(), ))
    works = cur.fetchall()

    return render_template(
        'index.html',
        users=UserForLogin.getAll(cur),
        columns=columns,
        tasks=tasks,
        works=WorkForDisplay.getAll(cur),
    )
def load_user(email):
    db = get_db()
    cur = db.cursor()
    return UserForLogin.getByEmail(cur, email)