def post(self):
    data = user_parser.parse_args()
    current_user = models.User.check_user(data['username'], data['password'])
    if (not current_user):
        abort(401)
        return {'message': "User {} doesn't exist".format(data['username'])}
    access_token = create_access_token(identity=data['username'])
    refresh_token = create_refresh_token(identity=data['username'])
    return {'message': 'Logged in as {}'.format(current_user.username), 'role': current_user.role, 'access_token': access_token, 'refresh_token': refresh_token}
def post(self):
    data = user_parser.parse_args()
    current_user = models.User.check_user(data['username'], data['password'])
    if (not current_user):
        abort(401)
        return {'message': "User {} doesn't exist".format(data['username'])}
    access_token = create_access_token(identity=data['username'])
    refresh_token = create_refresh_token(identity=data['username'])
    return {'message': 'Logged in as {}'.format(current_user.username), 'role': current_user.role, 'access_token': access_token, 'refresh_token': refresh_token}