def authenticate(self, password): resp = super(User, self).authenticate(password) if resp: auth_handler = MemcachedAuthHandler() resp = auth_handler.set(self) g.auth_token = resp return resp
def load_current_user(cls, apply_timeout=True): auth_handler = MemcachedAuthHandler() data = auth_handler.get( getattr(g, 'auth_token', None) or get_current_token()) if not data: return None return cls.query.filter(and_( cls.username == data['username'], cls.is_active)).first()