Registration and Join Organization: Fixed private key of the user in Join and allowin...
[unfold.git] / portal / slicerequestview.py
index 449147c..95d2794 100644 (file)
@@ -34,6 +34,8 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         slice_name =''
         purpose=''
         exp_url=''
+        authority_hrn = None
+        authority_name = None
         # Retrieve the list of authorities
         authorities_query = Query.get('authority').select('name', 'authority_hrn')
         authorities = execute_admin_query(wsgi_request, authorities_query)
@@ -53,6 +55,9 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             if authority['authority_hrn'] == user_authority:
                 authority_name = authority['name']
 
+        # Handle the case when we use only hrn and not name
+        if authority_name is None:
+            authority_name = user_authority
         #
         account_query  = Query().get('local:account').select('user_id','platform_id','auth_type','config')
         account_details = execute_query(wsgi_request, account_query)
@@ -83,6 +88,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
         page = Page(wsgi_request)
         page.add_js_files  ( [ "js/jquery.validate.js", "js/jquery-ui.js" ] )
         page.add_css_files ( [ "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] )
+        page.expose_js_metadata()
 
         if method == 'POST':
             # The form has been submitted
@@ -92,12 +98,13 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             current_site = current_site.domain
             
             # getting the authority_hrn from the selected organization
-            authority_hrn = ''           
             for authority in authorities:
                 if authority['name'] == wsgi_request.POST.get('org_name', ''):
                     authority_hrn = authority['authority_hrn']
 
-            
+            # Handle the case when we use only hrn and not name
+            if authority_hrn is None:
+                authority_hrn = wsgi_request.POST.get('org_name', '')
 
             slice_request = {
                 'type'              : 'slice',
@@ -168,6 +175,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             'exp_url': exp_url,
             'pi': pi,
             'authority_name': authority_name,        
+            'authority_hrn': user_authority,        
             'cc_myself': True,
             'authorities': authorities,
             'theme': self.theme,