diff --git a/CHANGELOG.md b/CHANGELOG.md index be0e942..9fda950 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. +## [0.0.7] - 2024-02-01 + +### Miscellaneous Tasks + +- Improve display in the admin +- Remove unused code in the `PasswordHistoryManager` + ## [0.0.6] - 2024-02-01 ### Bug Fixes diff --git a/password_rotate/managers.py b/password_rotate/managers.py index c458da0..c569fe4 100644 --- a/password_rotate/managers.py +++ b/password_rotate/managers.py @@ -1,10 +1,5 @@ -from datetime import timedelta - from django.db import models -from django.utils import timezone from django.contrib.auth.hashers import identify_hasher -from django.core.exceptions import ObjectDoesNotExist - from django.conf import settings @@ -27,26 +22,6 @@ def delete_expired(self, user, offset=None): entry = qs[offset:offset + 1].get() qs.filter(created__lte=entry.created).delete() - def change_required(self, user): - """ - Checks if the user needs to change his/her password. - - :arg object user: A :class:`~django.contrib.auth.models.User` instance. - :returns: ``True`` if the user needs to change his/her password, ``False`` otherwise. - :rtype: bool - """ - newest = self.get_newest(user) - if newest: - last_change = newest.created - else: - # TODO: Do not rely on this property! - last_change = user.date_joined - d = timedelta(seconds=settings.PASSWORD_DURATION_SECONDS) - expiry = timezone.now() - d - if last_change < expiry: - return True - return False - def check_password(self, user, raw_password): """ Compares a raw (UNENCRYPTED!!!) password to entries in the users's @@ -68,17 +43,3 @@ def check_password(self, user, raw_password): result = False break return result - - def get_newest(self, user): - """ - Gets the newest password history entry. - - :arg object user: A :class:`~django.contrib.auth.models.User` instance. - :returns: A :class:`~password_rotate.models.PasswordHistory` instance - if found, ``None`` if not. - """ - try: - entry = self.filter(user=user).latest() - except ObjectDoesNotExist: - return None - return entry