from flask_jwt import JWT
from mongoengine import DoesNotExist
from backend.models import User, to_md5


def authenticate(username, password):
    try:
        return User.objects.get(username=username, password=to_md5(password))
    except DoesNotExist:
        return None


def identity(payload):
    username = payload['identity']
    return User.objects.get(username=username)


jwt = JWT(None, authenticate, identity)

b747e0a51bf109bf6eeb99dd9a7547eb0111f2a1
<mask token>


def identity(payload):
    username = payload['identity']
    return User.objects.get(username=username)


<mask token>

<mask token>


def authenticate(username, password):
    try:
        return User.objects.get(username=username, password=to_md5(password))
    except DoesNotExist:
        return None


def identity(payload):
    username = payload['identity']
    return User.objects.get(username=username)


<mask token>

<mask token>


def authenticate(username, password):
    try:
        return User.objects.get(username=username, password=to_md5(password))
    except DoesNotExist:
        return None


def identity(payload):
    username = payload['identity']
    return User.objects.get(username=username)


jwt = JWT(None, authenticate, identity)

from flask_jwt import JWT
from mongoengine import DoesNotExist
from backend.models import User, to_md5


def authenticate(username, password):
    try:
        return User.objects.get(username=username, password=to_md5(password))
    except DoesNotExist:
        return None


def identity(payload):
    username = payload['identity']
    return User.objects.get(username=username)


jwt = JWT(None, authenticate, identity)
