Email: Dynamically add domain of the portal in email
authorYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 14 Apr 2014 09:47:59 +0000 (11:47 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Mon, 14 Apr 2014 09:47:59 +0000 (11:47 +0200)
portal/registrationview.py
portal/templates/user_request_email.html
portal/templates/user_request_email.txt

index 396d357..a4b5fd5 100644 (file)
@@ -6,6 +6,7 @@ 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
@@ -49,6 +50,10 @@ class RegistrationView (FreeAccessView, ThemeView):
 
         if method == 'POST':
             # The form has been submitted
+            
+            # get the domain url
+            current_site = Site.objects.get_current()
+            current_site = current_site.domain
 
             user_request = {
                 'first_name'    : wsgi_request.POST.get('firstname',     ''),
@@ -56,6 +61,7 @@ class RegistrationView (FreeAccessView, ThemeView):
                 'authority_hrn' : wsgi_request.POST.get('authority_hrn', ''),
                 'email'         : wsgi_request.POST.get('email',         '').lower(),
                 'password'      : wsgi_request.POST.get('password',      ''),
+                'current_site'  : current_site
             }
 
             # Construct user_hrn from email (XXX Should use common code)
index e8f2b38..b33d32f 100644 (file)
@@ -2,9 +2,10 @@
 <br>
 <h1>NEW USER REQUEST</h1>
 <br>
-<b>First Name   :</b> {{first_name}}
-<b>Last Name    :</b> {{last_name}}
+<b>First name   :</b> {{first_name}}
+<b>Last name    :</b> {{last_name}}
 <b>Authority hrn:</b> {{authority_hrn}}
 <b>Public key   :</b> {{public_key}}
 <b>Email        :</b> {{email}}
-<b>User Hrn     :</b> {{user_hrn}}
+<b>User hrn     :</b> {{user_hrn}}
+<b>Portal url  :</b> {{ current_site }}
index d38fd31..cce80cb 100644 (file)
@@ -1,8 +1,9 @@
 NEW USER REQUEST
 
-First Name   : {{first_name}}
-Last Name    : {{last_name}} 
+First name   : {{first_name}}
+Last name    : {{last_name}} 
 Authority hrn: {{authority_hrn}}
 Public key   : {{public_key}}
 Email        : {{email}}
-User Hrn     : {{user_hrn}}
+User hrn     : {{user_hrn}}
+Portal url   : {{ current_site }}