Beispiel #1
0
 def get_auth_token(self):
     """
     Encode a secure token for cookie
     """
     login_serializer = URLSafeTimedSerializer(configuration.get('auth', 'secret_key'))
     data = [str(self.id), self.password]
     return login_serializer.dumps(data)
Beispiel #2
0
 def get_auth_token(self):
     """
     Encode a secure token for cookie
     """
     login_serializer = URLSafeTimedSerializer(
         configuration.get('auth', 'secret_key'))
     data = [str(self.id), self.password]
     return login_serializer.dumps(data)
from flask import Flask, request
from flask.ext import restful
from flask_login import LoginManager
from itsdangerous import URLSafeTimedSerializer
from domain.auth import User
from datetime import timedelta

from utils.prod_setting import configuration

login_manager = LoginManager()


app = Flask(__name__)
app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
app.secret_key = configuration.get('auth', 'secret_key')
login_serializer = URLSafeTimedSerializer(app.secret_key)
api = restful.Api(app)

############################################################
# global view mapping start
############################################################


############################################################
# flask login api call back methods
############################################################
@login_manager.user_loader
def load_user(userid):
    print 'trying to load user'
    return User.query.filter(User.id == userid).first()
Beispiel #4
0
# -*- coding: utf-8 -*-

from flask import Flask, request
from flask.ext import restful
from flask_login import LoginManager
from itsdangerous import URLSafeTimedSerializer
from domain.auth import User
from datetime import timedelta

from utils.prod_setting import configuration

login_manager = LoginManager()

app = Flask(__name__)
app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
app.secret_key = configuration.get('auth', 'secret_key')
login_serializer = URLSafeTimedSerializer(app.secret_key)
api = restful.Api(app)

############################################################
# global view mapping start
############################################################


############################################################
# flask login api call back methods
############################################################
@login_manager.user_loader
def load_user(userid):
    return User.query.filter(User.id == userid).first()