summaryrefslogtreecommitdiffstats
path: root/accounts/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'accounts/models.py')
-rw-r--r--accounts/models.py36
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