Ejemplo n.º 1
0
def filter_user_email(email):
    """
    Filter user by email for check exist user.
    :param email: valid email.
    :return: email that requested, status(True : user exist, False : user not exist)
    """
    user = users.first(email=email)
    status = False
    if user:
        status = True
    return {'user': user, 'email': email, 'status': status}
Ejemplo n.º 2
0
    def validate(self):

        if not super(UpdatePasswordForm, self).validate():
            return False
        if self.currentPassword.data.strip() == '':
            return False
        if self.newPassword.data.strip() == '':
            return False
        if self.newPasswordConfirm.data.strip() == '':
            return False
        self.user = users.first(email=self.email.data)
        if self.user is None:
            return False
        if not verify_password(self.currentPassword.data, self.user.password):
            return False
        return True
Ejemplo n.º 3
0
    def validate(self):

        if not super(UpdatePasswordForm, self).validate():
            return False
        if self.currentPassword.data.strip() == '':
            return False
        if self.newPassword.data.strip() == '':
            return False
        if self.newPasswordConfirm.data.strip() == '':
            return False
        self.user = users.first(email=self.email.data)
        if self.user is None:
            return False
        if not verify_password(self.currentPassword.data, self.user.password):
            return False
        return True
 def validate(self):
     if not super(LoginForm, self).validate():
         self.errors[0] = 'login.failed'
         return False
     if self.loginEmail.data.strip() == '':
         return False
     if self.loginPassword.data.strip() == '':
         return False
     self.user = users.first(email=self.loginEmail.data)
     if self.user is None:
         self.errors[0] = 'login.userNotFound'
         return False
     if not verify_password(self.loginPassword.data, self.user.password):
         self.errors[0] = 'login.passwordIncorrect'
         return False
     if not self.user.is_active():
         self.errors[0] = 'login.userDisabled'
         return False
     self.errors[0] = 'login.welcome'
     return True