Esempio n. 1
0
 def save(self):
     email_value = self.validated_data["email"]
     for user in models.User.objects.filter(email__iexact=email_value,
                                            is_active=True):
         if user.has_usable_password() and _unicode_ci_compare(
                 email_value, user.email):
             email.password_forget(self.request, user)
Esempio n. 2
0
 def get_users(self, email):
     active_users = models.User.objects.filter(
         email__iexact=email,
         active=True,
         is_superuser=False,
     )
     return (user for user in active_users if user.has_usable_password()
             and auth_forms._unicode_ci_compare(email, user.email))
Esempio n. 3
0
 def get_users(self, email):
     """Given an email, return matching user(s) who should receive a link
         for registration.
     """
     email_field_name = UserModel.get_email_field_name()
     inactive_users = UserModel._default_manager.filter(
         **{
             '%s__iexact' % email_field_name: email,
             'is_active': False,
         })
     return (u for u in inactive_users if not u.has_usable_password()
             and _unicode_ci_compare(email, getattr(u, email_field_name)))
Esempio n. 4
0
    def get_users(self, email):
        """Given an email, return matching user(s) who should receive a reset.

        This allows subclasses to more easily customize the default policies
        that prevent inactive users and users with unusable passwords from
        resetting their password.
        """
        email_field_name = UserModel.get_email_field_name()
        active_users = UserModel._default_manager.filter(
            **{
                '%s__iexact' % email_field_name: email,
            })

        return (u for u in active_users if u.has_usable_password()
                and _unicode_ci_compare(email, getattr(u, email_field_name)))
Esempio n. 5
0
 def get_users(self, email):
     """Given an email, return matching user(s) who should receive a reset.
     This allows subclasses to more easily customize the default policies
     that prevent inactive users and users with unusable passwords from
     resetting their password.
     """
     email_field_name = auth_forms.UserModel.get_email_field_name()
     active_users = auth_forms.UserModel._default_manager.filter(
         **{
             "%s__iexact" % email_field_name: email,
             "is_active": True,
         })
     return (
         u for u in active_users
         # Users with unusable passwords in the DB should be able to reset their passwords, the new password will be
         # set in the LDAP instead. See models.LdapUser
         # if u.has_usable_password() and
         if auth_forms._unicode_ci_compare(email,
                                           getattr(u, email_field_name)))
Esempio n. 6
0
 def get_users(self, email):
     email_field_name = User.get_email_field_name()
     active_users = User._default_manager.filter(
         **{'%s__iexact' % email_field_name: email})
     return (u for u in active_users if u.has_usable_password()
             and _unicode_ci_compare(email, getattr(u, email_field_name)))