From 23f458908f761977c0b7f187db5ad488c4d78658 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Tue, 15 Oct 2013 00:49:35 +0200 Subject: Moved user implementation from model to login --- app/login.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'app/login.py') 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) -- cgit v1.2.3-70-g09d2