Exemple #1
0
def authenticate(username, password):
    ret = {}
    if username and password:
        result = User.is_exists(username, hash(password))
        if result:
            ret['msg'] = 'ok'
        else:
            ret['msg'] = 'username or password error'
    else:
        ret['msg'] = 'username or password is empty'
    return ret
Exemple #2
0
def authentic(username, password):
    if username and password:
        result = User.is_exists(username, hash(password))
        if result:
            msg = 'ok'
        else:
            msg = 'username / password not match'
    else:
        result = False
        msg = 'empty username or password'
    ret = {
        'msg': msg,
        'result': result,
    }
    return ret