Exemple #1
0
Fichier : auth.py Projet : kzkn/fc
def do_login(password):
    user = users.find_by_password(password)
    if user:
        session['user_id'] = user.id
        session.permanent = True

    return True if user else False
Exemple #2
0
def test_get_or_gen_password():
    f1 = {"password": "******"}
    p1 = users.get_or_gen_password(f1)
    assert p1 == "1234"

    f2 = {"password": ""}
    p2 = users.get_or_gen_password(f2)
    assert not users.find_by_password(p2)
Exemple #3
0
Fichier : auth.py Projet : kzkn/fc
def do_mobile_login(password):
    user = users.find_by_password(password)
    if user:
        sid = users.issue_new_session_id(user.id)
    return (user.id, sid) if user else (None, None)