def check_auth(username, password):
    u = Users()
    all = u.list(internal=True)
    if len(all) == 0 and (username == DEFAULT_USER and password == DEFAULT_PASS):
        u.add(dict(name=DEFAULT_USER, _password=DEFAULT_PASS))
        return True
    return u.login(username, password)
Example #2
0
def check_auth(username, password):
    u = Users()
    all = u.list(internal=True)
    if len(all) == 0 and (username == DEFAULT_USER
                          and password == DEFAULT_PASS):
        u.add(dict(name=DEFAULT_USER, _password=DEFAULT_PASS))
        return True
    return u.login(username, password)
Example #3
0
def check_auth(username, password):
    u = Users()
    all = u.list(internal=True)
    if len(all) == 0 and (username == DEFAULT_USER and password == DEFAULT_PASS):
        u.add(dict(name=DEFAULT_USER, _password=DEFAULT_PASS))
        return True
    if not u.login(username, password):
        log("login failed: %s" % (username))
        return False
    else:
        log("login successful: %s" % (username))
    return True