This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/develop by this push:
     new 8aae7769 download_code and show_code
     new 9f649b21 Merge pull request #124 from isururanawaka/develop
8aae7769 is described below

commit 8aae77694c2cb72a5ebb0138fdde264e2fde14b6
Author: Isuru Ranawaka <[email protected]>
AuthorDate: Tue Oct 25 11:14:09 2022 -0400

    download_code and show_code
---
 .../django_airavata_auth/login-desktop-success.html       |  5 +++++
 django_airavata/apps/auth/views.py                        | 15 ++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git 
a/django_airavata/apps/auth/templates/django_airavata_auth/login-desktop-success.html
 
b/django_airavata/apps/auth/templates/django_airavata_auth/login-desktop-success.html
index 4dbed981..63d02745 100644
--- 
a/django_airavata/apps/auth/templates/django_airavata_auth/login-desktop-success.html
+++ 
b/django_airavata/apps/auth/templates/django_airavata_auth/login-desktop-success.html
@@ -8,6 +8,11 @@
       <div class="alert alert-success" role="alert">
         <h4 class="alert-heading">Logged in!</h4>
       </div>
+      <div class="container">
+         {% if options.show_code  %}
+           <h3> {{ options.code }}</h3>
+         {% endif %}
+      </div>
     </div>
   </main>
 </div>
diff --git a/django_airavata/apps/auth/views.py 
b/django_airavata/apps/auth/views.py
index 0b4fdd93..abb65b27 100644
--- a/django_airavata/apps/auth/views.py
+++ b/django_airavata/apps/auth/views.py
@@ -479,7 +479,20 @@ def login_desktop(request):
 
 
 def login_desktop_success(request):
-    return render(request, 'django_airavata_auth/login-desktop-success.html')
+    download_code= False
+    show_code =False
+    for filter_item in self.request.query_params.items():
+        if filter_item[0] == 'download_code':
+            download_code = filter_item[1]
+        elif filter_item[0] == 'show_code':
+             show_code = filter_item[1]
+
+    context = {
+        'download_code': download_code,
+        'show_code': show_code,
+        'code': request.session['ACCESS_TOKEN']
+    } if (download_code and show_code ) else {}
+    return render(request, 'django_airavata_auth/login-desktop-success.html', 
context)
 
 
 def refreshed_token_desktop(request):

Reply via email to