コード例 #1
0
def create_user(firstname, lastname, email, pwd, promo):
    status = False
    email = email.lower()
    if not user_exists(email):
        hashedpwd = bcrypt.hashpw(pwd.encode(), bcrypt.gensalt()).decode()
        UserCRUD.create(firstname, lastname, email, hashedpwd, promo)
        return True
    return False
コード例 #2
0
def delete_user(uid):
    UserLocationCRUD.delete(uid=uid)
    UserPreferencesCRUD.delete(uid=uid)
    UserCRUD.delete(uid=uid)
コード例 #3
0
def update_user(uid, **kwargs):
    return UserCRUD.update(uid, **kwargs)
コード例 #4
0
def search_users(filters):
    # retrieve and normalize filters
    promo_filter = normalize_filter(filters.get('promo', None))
    firstname_filter = normalize_filter(filters.get('firstname', None))
    lastname_filter = normalize_filter(filters.get('lastname', None))
    return UserCRUD.search(firstname_filter, lastname_filter, promo_filter)
コード例 #5
0
def retrieve_all_users():
    (s, q) = UserCRUD.retrieve()
    res = q.all()
    s.close()
    return res
コード例 #6
0
def retrieve_user_by_email(email):
    email = email.lower()
    (s, q) = UserCRUD.retrieve(email=email)
    res = q.one_or_none()
    s.close()
    return res
コード例 #7
0
def retrieve_user_by_id(uid):
    (s, q) = UserCRUD.retrieve(uid=uid)
    res = q.one_or_none()
    s.close()
    return res