diff options
author | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-04-02 23:46:00 +0200 |
---|---|---|
committer | Jonah BrĂ¼chert <jbb@kaidan.im> | 2024-05-07 13:51:25 +0200 |
commit | 52edda02e6fee2c8122fac71c49ea711672b4d92 (patch) | |
tree | 51523124e041bb27f89e27cf7d4606c8ddefd41c /accounts/models.py | |
parent | 17f8ee678cbc4dafbef53ce1b9a852728955fd3e (diff) | |
download | web-remove-service-passwords.tar.gz web-remove-service-passwords.tar.bz2 web-remove-service-passwords.zip |
Remove service passwords featureremove-service-passwords
Diffstat (limited to 'accounts/models.py')
-rw-r--r-- | accounts/models.py | 36 |
1 files changed, 3 insertions, 33 deletions
diff --git a/accounts/models.py b/accounts/models.py index 8b34fab..ac5ce78 100644 --- a/accounts/models.py +++ b/accounts/models.py @@ -5,23 +5,6 @@ from typing import Any, Optional from accounts.utils.login import create_userid -class Service(object): - id: str - name: str - url: str - - def __init__(self, service_id: str, name: str, url: str) -> None: - self.id = service_id - self.name = name - self.url = url - - #: Wether the user has a separate password for this service. - self.changed = False - - def __repr__(self): - return "<Service %s>" % self.id - - class Account(UserMixin): """ An Account represents a complex ldap tree entry for spline users. @@ -31,9 +14,7 @@ class Account(UserMixin): _ready = False uid: str - services: list[str] password: Optional[str] - new_password_services: dict[str, tuple[Optional[str], Optional[str]]] attributes: dict[Any, Any] new_password_root: Optional[tuple[Optional[str], Optional[str]]] @@ -41,15 +22,12 @@ class Account(UserMixin): self, uid: str, mail: str, - services=None, password: Optional[str] = None, uidNumber=None, ): self.uid = uid - self.services = list() if services is None else services self.password = password self.new_password_root = None - self.new_password_services = {} self.attributes = {} self.uidNumber = uidNumber @@ -59,22 +37,14 @@ class Account(UserMixin): def __repr__(self): return "<Account uid=%s>" % self.uid - def reset_password(self, service: str): - self.new_password_services[service] = (None, None) - def change_password( - self, new_password: str, old_password="", service=None + self, new_password: str, old_password="" ): """ - Changes a password for a given service. You have to use the - UserBackend to make the changes permanent. If no service is given, - the root password will be changed. + Changes the password of the account """ - if not service: - self.new_password_root = (old_password, new_password) - else: - self.new_password_services[service] = (old_password, new_password) + self.new_password_root = (old_password, new_password) def _set_attribute(self, key: str, value: Any) -> None: self.attributes[key] = value |