コード例 #1
0
def get_login_errors(username, password):
    vp, p = valid_password(password)
    vu, u = valid_username(username)
    if vu and vp:
        _, e = valid_user_at_login(username, password)
    else:
        e = {}

    d =  add_dicts(p, u, e)
    return d
コード例 #2
0
def valid(username, email, password, confirmation):
    #TODO: check confirmation password, implemented in valid_passwords
    _, u = valid_username(username)
    ue, _ = user_exists(username)
    _, p = valid_passwords(password, confirmation)
    _, e = valid_email(email)
    ux = {}
    if ue:
        ux = {'error_user_exists': 'Username taken'}
    errors = add_dicts(u, e, p, ux)
    if not errors:
        return True, {}

    return False, errors