X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fjoinview.py;h=d4e4af5a249e2028491220b86a650a28b453f456;hb=5df37d96aa758faa548091932a5d00a76aa16551;hp=0282e9623b9e799d723f2fa408694d8b898322d7;hpb=3b39e97b04f9333fd58978120f00c1b4ffffbc41;p=myslice.git diff --git a/portal/joinview.py b/portal/joinview.py index 0282e962..d4e4af5a 100644 --- a/portal/joinview.py +++ b/portal/joinview.py @@ -9,7 +9,6 @@ from django.views.generic import View 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 @@ -22,6 +21,7 @@ from portal.models import PendingUser,PendingAuthority from portal.actions import authority_get_pi_emails, manifold_add_user,manifold_add_account, create_pending_user from myslice.theme import ThemeView +from myslice.settings import logger import activity.institution @@ -154,9 +154,12 @@ class JoinView (FreeAccessView, ThemeView): reg_password = request.POST['pi_password'] salt = randint(1,100000) - # get the domain url - current_site = Site.objects.get_current() - current_site = current_site.domain + + if request.is_secure(): + current_site = 'https://' + else: + current_site = 'http://' + current_site += request.META['HTTP_HOST'] email_hash = md5(str(salt)+reg_email).hexdigest() user_request = { @@ -173,7 +176,7 @@ class JoinView (FreeAccessView, ThemeView): 'user_hrn' : user_hrn, 'pi' : [reg_auth], 'auth_type' : 'managed', - 'validation_link': 'http://' + current_site + '/portal/email_activation/'+ email_hash + 'validation_link': current_site + '/portal/email_activation/'+ email_hash } @@ -229,9 +232,9 @@ class JoinView (FreeAccessView, ThemeView): msg.send() except Exception, e: - print "Failed to send email, please check the mail templates and the SMTP configuration of your server" + logger.error("Failed to send email, please check the mail templates and the SMTP configuration of your server") import traceback - traceback.print_exc() + logger.error(traceback.format_exc()) self.template_name = 'join_complete.html' # log institution activity