Exemple #1
0
def user_loader_from_request(request):
    from maple.model import User
    token = request.headers.get('Token')
    if not token:
        token = request.args.get('token')
    if token is not None:
        user = User.check_token(token)
        if user:
            login_user(user, True)
            return user
Exemple #2
0
def request_loader(request):
    from maple.model import User
    token = request.headers.get('Maple-Token', request.args.get('maple_token'))
    user = None
    if token:
        user = User.check_token(token)
    if not user:
        return
    user.login(True)
    return user