summaryrefslogtreecommitdiffstats
path: root/accounts/models.py
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2016-01-25 00:15:12 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2016-02-02 04:22:16 +0100
commit7619809115e6fdc3d7df8705abb20f228863e7c2 (patch)
tree5afaeeb9020d418143b7cea3e1e2540efcc2140e /accounts/models.py
parent753c03b3477071279299ca47ce76f5fcd346d5bd (diff)
downloadweb-7619809115e6fdc3d7df8705abb20f228863e7c2.tar.gz
web-7619809115e6fdc3d7df8705abb20f228863e7c2.tar.bz2
web-7619809115e6fdc3d7df8705abb20f228863e7c2.zip
Use Flask-Login for login handling
Diffstat (limited to 'accounts/models.py')
-rw-r--r--accounts/models.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/accounts/models.py b/accounts/models.py
index 9e0c45e..f967180 100644
--- a/accounts/models.py
+++ b/accounts/models.py
@@ -1,6 +1,11 @@
# -*- coding: utf-8 -*-
+from __future__ import absolute_import
+from flask.ext.login import UserMixin
-class Account(object):
+from accounts.utils.login import create_userid
+
+
+class Account(UserMixin):
"""
An Account represents a complex ldap tree entry for spline users.
For each service a spline user can have a different password.
@@ -62,6 +67,13 @@ class Account(object):
raise AttributeError("'%s' object has no attribute '%s'" %
(self.__class__.__name__, name))
+ def get_id(self):
+ """
+ This is for flask-login. The returned string is saved inside
+ the cookie and used to identify the user.
+ """
+ return create_userid(self.uid, self.password)
+
class Service(object):
def __init__(self, id, name, url):