X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fregistrationview.py;h=76d712da2441f64e8104d08a25a095b9f75ff55a;hb=refs%2Fheads%2Fonelab;hp=9032125f0d65ab4fc978f3973c56c377a4f32832;hpb=a1a3600ebe8c121ad6ec801307066373f5d9889a;p=myslice.git diff --git a/portal/registrationview.py b/portal/registrationview.py index 9032125f..76d712da 100644 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@ -9,7 +9,6 @@ from django.template.loader import render_to_string from django.shortcuts import render from django.contrib.auth import get_user_model -from django.contrib.sites.models import Site from unfold.page import Page from unfold.loginrequired import FreeAccessView @@ -19,7 +18,7 @@ from manifoldapi.manifoldapi import execute_admin_query from manifold.core.query import Query from portal.models import PendingUser -from portal.actions import create_pending_user +from portal.actions import create_pending_user, getAuthorities from myslice.theme import ThemeView from myslice.settings import logger @@ -42,16 +41,18 @@ class RegistrationView (FreeAccessView, ThemeView): """ """ errors = [] - authority_hrn = None - # REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2 - authorities_query = Query.get('authority').select('name', 'authority_hrn') - authorities = execute_admin_query(wsgi_request, authorities_query) - logger.info("RegistrationView authorities = {}".format(authorities)) - if authorities is not None: - # Remove the root authority from the list - matching = [s for s in authorities if "." in s['authority_hrn']] - authorities = sorted(matching, key=lambda k: k['authority_hrn']) - authorities = sorted(matching, key=lambda k: k['name']) + + authorities = getAuthorities(wsgi_request, admin = True) + + #authority_hrn = None + ## REGISTRY ONLY TO BE REMOVED WITH MANIFOLD-V2 + #authorities_query = Query.get('authority').select('name', 'authority_hrn') + #authorities = execute_admin_query(wsgi_request, authorities_query) + #if authorities is not None: + # # Remove the root authority from the list + # matching = [s for s in authorities if "." in s['authority_hrn']] + # authorities = sorted(matching, key=lambda k: k['authority_hrn']) + # authorities = sorted(matching, key=lambda k: k['name']) logger.debug("############ BREAKPOINT 1 #################") # Page rendering @@ -68,10 +69,12 @@ class RegistrationView (FreeAccessView, ThemeView): reg_form = {} # The form has been submitted - # get the domain url - current_site = Site.objects.get_current() - current_site = current_site.domain - + if wsgi_request.is_secure(): + current_site = 'https://' + else: + current_site = 'http://' + current_site += wsgi_request.META['HTTP_HOST'] + logger.debug("############ BREAKPOINT 3 #################") post_email = wsgi_request.POST.get('email','').lower() salt = randint(1,100000)