prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add a feature to show the authentication token to the user on the MyProfile Page
  **Deliverables:**
  
  - [x] Add API endpoint to fetch or create (if doesn't exists) the token from database.
  
  - [x] Add Frontend with features to show, copy and download the token in JSON format
  
  
  </issue>
  <code>
  [start of apps/accounts/urls.py]
  1 from django.conf.urls import url
  2 
  3 from . import views
  4 
  5 urlpatterns = [
  6 
  7     url(r'^user/disable$', views.disable_user, name='disable_user'),
  8 
  9 ]
  10
  [end of apps/accounts/urls.py]
  [start of apps/accounts/views.py]
  1 from django.contrib.auth import logout
  2 
  3 from rest_framework.response import Response
  4 from rest_framework import permissions, status
  5 from rest_framework.decorators import (api_view,
  6                                        authentication_classes,
  7                                        permission_classes,)
  8 from rest_framework_expiring_authtoken.authentication import (ExpiringTokenAuthentication,)
  9 
  10 
  11 @api_view(['POST'])
  12 @permission_classes((permissions.IsAuthenticated,))
  13 @authentication_classes((ExpiringTokenAuthentication,))
  14 def disable_user(request):
  15 
  16     user = request.user
  17     user.is_active = False
  18     user.save()
  19     logout(request)
  20     return Response(status=status.HTTP_200_OK)
  21
  [end of apps/accounts/views.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/apps/accounts/urls.py b/apps/accounts/urls.py
  --- a/apps/accounts/urls.py
  +++ b/apps/accounts/urls.py
  @@ -5,5 +5,6 @@
   urlpatterns = [
   
       url(r'^user/disable$', views.disable_user, name='disable_user'),
  +    url(r'^user/get_auth_token$', views.get_auth_token, name='get_auth_token'),
   
   ]
  diff --git a/apps/accounts/views.py b/apps/accounts/views.py
  --- a/apps/accounts/views.py
  +++ b/apps/accounts/views.py
  @@ -1,12 +1,18 @@
   from django.contrib.auth import logout
  +from django.contrib.auth.models import User
   
  +from rest_framework.authtoken.models import Token
   from rest_framework.response import Response
   from rest_framework import permissions, status
   from rest_framework.decorators import (api_view,
                                          authentication_classes,
  -                                       permission_classes,)
  +                                       permission_classes,
  +                                       throttle_classes,)
  +from rest_framework.throttling import UserRateThrottle
   from rest_framework_expiring_authtoken.authentication import (ExpiringTokenAuthentication,)
   
  +from .permissions import HasVerifiedEmail
  +
   
   @api_view(['POST'])
   @permission_classes((permissions.IsAuthenticated,))
  @@ -18,3 +24,24 @@
       user.save()
       logout(request)
       return Response(status=status.HTTP_200_OK)
  +
  +
  +@throttle_classes([UserRateThrottle])
  +@api_view(['GET'])
  +@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))
  +@authentication_classes((ExpiringTokenAuthentication,))
  +def get_auth_token(request):
  +    try:
  +        user = User.objects.get(email=request.user.email)
  +    except User.DoesNotExist:
  +        response_data = {"error": "This User account doesn't exist."}
  +        Response(response_data, status.HTTP_404_NOT_FOUND)
  +
  +    try:
  +        token = Token.objects.get(user=user)
  +    except Token.DoesNotExist:
  +        token = Token.objects.create(user=user)
  +        token.save()
  +
  +    response_data = {"token": "{}".format(token)}
  +    return Response(response_data, status=status.HTTP_200_OK)
  
verification_info: {"golden_diff": "diff --git a/apps/accounts/urls.py b/apps/accounts/urls.py\n--- a/apps/accounts/urls.py\n+++ b/apps/accounts/urls.py\n@@ -5,5 +5,6 @@\n urlpatterns = [\n \n     url(r'^user/disable$', views.disable_user, name='disable_user'),\n+    url(r'^user/get_auth_token$', views.get_auth_token, name='get_auth_token'),\n \n ]\ndiff --git a/apps/accounts/views.py b/apps/accounts/views.py\n--- a/apps/accounts/views.py\n+++ b/apps/accounts/views.py\n@@ -1,12 +1,18 @@\n from django.contrib.auth import logout\n+from django.contrib.auth.models import User\n \n+from rest_framework.authtoken.models import Token\n from rest_framework.response import Response\n from rest_framework import permissions, status\n from rest_framework.decorators import (api_view,\n                                        authentication_classes,\n-                                       permission_classes,)\n+                                       permission_classes,\n+                                       throttle_classes,)\n+from rest_framework.throttling import UserRateThrottle\n from rest_framework_expiring_authtoken.authentication import (ExpiringTokenAuthentication,)\n \n+from .permissions import HasVerifiedEmail\n+\n \n @api_view(['POST'])\n @permission_classes((permissions.IsAuthenticated,))\n@@ -18,3 +24,24 @@\n     user.save()\n     logout(request)\n     return Response(status=status.HTTP_200_OK)\n+\n+\n+@throttle_classes([UserRateThrottle])\n+@api_view(['GET'])\n+@permission_classes((permissions.IsAuthenticated, HasVerifiedEmail))\n+@authentication_classes((ExpiringTokenAuthentication,))\n+def get_auth_token(request):\n+    try:\n+        user = User.objects.get(email=request.user.email)\n+    except User.DoesNotExist:\n+        response_data = {\"error\": \"This User account doesn't exist.\"}\n+        Response(response_data, status.HTTP_404_NOT_FOUND)\n+\n+    try:\n+        token = Token.objects.get(user=user)\n+    except Token.DoesNotExist:\n+        token = Token.objects.create(user=user)\n+        token.save()\n+\n+    response_data = {\"token\": \"{}\".format(token)}\n+    return Response(response_data, status=status.HTTP_200_OK)\n", "issue": "Add a feature to show the authentication token to the user on the MyProfile Page\n**Deliverables:**\r\n\r\n- [x] Add API endpoint to fetch or create (if doesn't exists) the token from database.\r\n\r\n- [x] Add Frontend with features to show, copy and download the token in JSON format\r\n\n", "before_files": [{"content": "from django.conf.urls import url\n\nfrom . import views\n\nurlpatterns = [\n\n    url(r'^user/disable$', views.disable_user, name='disable_user'),\n\n]\n", "path": "apps/accounts/urls.py"}, {"content": "from django.contrib.auth import logout\n\nfrom rest_framework.response import Response\nfrom rest_framework import permissions, status\nfrom rest_framework.decorators import (api_view,\n                                       authentication_classes,\n                                       permission_classes,)\nfrom rest_framework_expiring_authtoken.authentication import (ExpiringTokenAuthentication,)\n\n\n@api_view(['POST'])\n@permission_classes((permissions.IsAuthenticated,))\n@authentication_classes((ExpiringTokenAuthentication,))\ndef disable_user(request):\n\n    user = request.user\n    user.is_active = False\n    user.save()\n    logout(request)\n    return Response(status=status.HTTP_200_OK)\n", "path": "apps/accounts/views.py"}]}