Repository: Cloud-CV/EvalAI

Issue:
Create a template view to show after successful email verification during Signup
### Description

When a user registers on EvalAI, he receives an email that contains a unique link to confirm his email id. Whenever he clicks on the link, he should be shown a static page similar to this http://api.evalai.cloudcv.org/api/auth/registration/account-confirm-email/MTc:1cpmQ6:0_PqK9K-JJuKYxC3aSY2Bjt3OLU/

### Todo 

1. Override the URL Patterns for the URL  `/api/auth/registration/account-confirm-email/<token>/` to convert it to django TemplateView
2. Create a template at the backend that is served to the user whenever he clicks on the unique link. 


Discussion:
Can I work on this?
@mayank-agarwal-96 sure. 
@deshraj Right now ConfirmEmailView ( which is an APIView ) is called on this url. So do I need to change this with a TemplateView?
Yeah, please do that and delete the APIView in the views file. 
@deshraj Ok, thank you :)
@deshraj I am stuck on finding a good way to reuse css and images in the frontend directory for the email confirmation template. Will adding it to static help?

@mayank-agarwal-96 Since both the frontend and backend are independent of each other, so it would be a good idea to not reuse the static files. Can you please create different static files for the backend? 
@deshraj Ok sure, it would also be easier to create new static files.

Resolving patch:
diff --git a/apps/accounts/views.py b/apps/accounts/views.py
--- a/apps/accounts/views.py
+++ b/apps/accounts/views.py
@@ -1,8 +1,5 @@
 from django.contrib.auth import logout
-from django.urls import reverse
 
-from rest_framework.views import APIView
-from rest_framework.permissions import AllowAny
 from rest_framework.response import Response
 from rest_framework import permissions, status
 from rest_framework.decorators import (api_view,
@@ -10,25 +7,6 @@
                                        permission_classes,)
 from rest_framework_expiring_authtoken.authentication import (ExpiringTokenAuthentication,)
 
-import requests
-
-
-class ConfirmEmailView(APIView):
-    """
-    APIView for confirming email after registration
-    """
-    permission_classes = (AllowAny,)
-    allowed_methods = ('GET', 'OPTIONS', 'HEAD')
-
-    def get(self, request, *args, **kwargs):
-        post_data = {
-            'key': kwargs['key'],
-        }
-
-        requests.post(request.build_absolute_uri(
-            reverse("rest_verify_email")), data=post_data)
-        return Response({'message': "Email verified successfully"}, status=status.HTTP_200_OK)
-
 
 @api_view(['POST'])
 @permission_classes((permissions.IsAuthenticated,))
diff --git a/evalai/urls.py b/evalai/urls.py
--- a/evalai/urls.py
+++ b/evalai/urls.py
@@ -20,9 +20,9 @@
 from django.conf import settings
 from django.conf.urls.static import static
 
+from allauth.account.views import ConfirmEmailView
 from rest_framework_expiring_authtoken.views import obtain_expiring_auth_token
 
-from accounts.views import ConfirmEmailView
 from web import views
 
 handler404 = 'web.views.page_not_found'
diff --git a/settings/common.py b/settings/common.py
--- a/settings/common.py
+++ b/settings/common.py
@@ -138,7 +138,7 @@
 # https://docs.djangoproject.com/en/1.10/howto/static-files/
 
 STATIC_URL = '/static/'
-
+STATIC_ROOT = os.path.join(BASE_DIR, 'static')
 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
 MEDIA_URL = "/media/"
 


Test patch: