Exemple #1
0
def create(email, username, password):
    user = User(
        email=email,
        username=username,
        password=password
    )
    user.save()
    return user
Exemple #2
0
def find_all():
    users = User.objects()
    return list(users)
Exemple #3
0
def change_password(id, password):
    user = User.objects(id=id).first()
    if (user_exists(user)):
        user.password = password
        user.save()
        return user;
Exemple #4
0
def delete_by_email(email):
    user = User.objects(email=email).first()
    if user_exists(user):
        user.delete()
Exemple #5
0
def delete_by_username(username):
    user = User.objects(username=username).first()
    if user_exists(user):
        user.delete()
Exemple #6
0
def delete_by_id(identifier):
    user = User.objects(id=identifier).first()
    if user_exists(user):
        user.delete()
Exemple #7
0
def find_by_username(username):
    user = User.objects(username=username).first()
    return user_exists(user)
Exemple #8
0
def find_by_email(email):
    user = User.objects(email=email).first()
    return user_exists(user)
Exemple #9
0
def find(identifier):
    user = User.objects(id=identifier).first()
    return user_exists(user)
Exemple #10
0
def identity(payload):
    user_id = payload['identity']
    return User.objects(id=user_id).first()