summaryrefslogtreecommitdiff
path: root/app/login.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/login.py')
-rw-r--r--app/login.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/login.py b/app/login.py
index 6d3fdfa..f4501c8 100644
--- a/app/login.py
+++ b/app/login.py
@@ -1,4 +1,4 @@
-from flask.ext.login import LoginManager
+from flask.ext.login import LoginManager, UserMixin
# just for exporting
from flask.ext.login import login_user, logout_user, login_required, current_user
@@ -6,9 +6,15 @@ from flask.ext.login import login_user, logout_user, login_required, current_use
from passlib.apps import custom_app_context as pwd_context
from . import app
-from .model import User
+from . import model
login_manager = LoginManager()
login_manager.init_app(app)
-login_manager.user_loader(User.get)
+class User (model.User, UserMixin):
+ def check_password(self, pwd):
+ return pwd_context.verify(pwd, self.pwd)
+
+@login_manager.user_loader
+def load_user(id):
+ return User.get(id)