from jwt_auth.forms import JSONWebTokenForm


def loginUser(username, password):
    """Should login user and return a jwt token, piggyback on jwt_auth"""
    request = {"username": username, "password": password}
    form = JSONWebTokenForm(request)
    if not form.is_valid():
        return print("JWT form not valid")

    context_dict = {
        'token': form.object['token']
    }

    return context_dict

from jwt_auth.forms import JSONWebTokenForm


def loginUser(username, password):
    """Should login user and return a jwt token, piggyback on jwt_auth"""
    request = {"username": username, "password": password}
    form = JSONWebTokenForm(request)
    if not form.is_valid():
        return print("JWT form not valid")

    return form.object['token']

Return the token string instead of object with string
Return the token string instead of object with string

  from jwt_auth.forms import JSONWebTokenForm
  
  
  def loginUser(username, password):
      """Should login user and return a jwt token, piggyback on jwt_auth"""
      request = {"username": username, "password": password}
      form = JSONWebTokenForm(request)
      if not form.is_valid():
          return print("JWT form not valid")
  
-     context_dict = {
-         'token': form.object['token']
+     return form.object['token']
-     }
  
-     return context_dict
- 
Return the token string instead of object with string
## Code Before:
from jwt_auth.forms import JSONWebTokenForm


def loginUser(username, password):
    """Should login user and return a jwt token, piggyback on jwt_auth"""
    request = {"username": username, "password": password}
    form = JSONWebTokenForm(request)
    if not form.is_valid():
        return print("JWT form not valid")

    context_dict = {
        'token': form.object['token']
    }

    return context_dict

## Instruction:
Return the token string instead of object with string
## Code After:
from jwt_auth.forms import JSONWebTokenForm


def loginUser(username, password):
    """Should login user and return a jwt token, piggyback on jwt_auth"""
    request = {"username": username, "password": password}
    form = JSONWebTokenForm(request)
    if not form.is_valid():
        return print("JWT form not valid")

    return form.object['token']
