Esempio n. 1
0
def user_exists(id):
    user_exists = False
    for user in User.select():
        user_id = "{}{}".format(user.id, user.salt)
        if user_id == str(id):
            user_exists = True
    return user_exists
Esempio n. 2
0
def email_exists(form, field):
    if User.select().where(User.email == field.data).exists():
        raise ValidationError("Email already in use.")
Esempio n. 3
0
def username_in_use(form, field):
    if User.select().where(User.username == field.data).exists():
        raise ValidationError("Username already in use.")
Esempio n. 4
0
def username_exists(form, field):
    if not User.select().where(User.username == field.data).exists():
        raise ValidationError("User does not exist.")