From 1b585d116ff4ec2538326740c36562735ea25ff6 Mon Sep 17 00:00:00 2001
From: Yasin
Date: Fri, 29 Aug 2014 11:52:08 +0200
Subject: [PATCH] User validated email: updated as timur suggested
---
portal/actions.py | 22 ++++++++++++++++---
portal/templates/slice-request-done-view.html | 4 ++--
portal/templates/user_request_validated.html | 16 ++++++++++++++
portal/templates/user_request_validated.txt | 12 ++++++++++
4 files changed, 49 insertions(+), 5 deletions(-)
create mode 100644 portal/templates/user_request_validated.html
create mode 100644 portal/templates/user_request_validated.txt
diff --git a/portal/actions.py b/portal/actions.py
index 3fed09d6..ea87918f 100644
--- a/portal/actions.py
+++ b/portal/actions.py
@@ -654,9 +654,25 @@ def sfa_create_user(wsgi_request, request, namespace = None, as_admin = False):
if not results:
raise Exception, "Could not create %s. Already exists ?" % sfa_user_params['user_hrn']
else:
- subject = 'User validated'
- msg = 'A manager of your institution has validated your account. You have now full user access to the portal.'
- send_mail(subject, msg, 'support@onelab.eu',[request['email']], fail_silently=False)
+ try:
+ theme.template_name = 'user_request_validated.txt'
+ text_content = render_to_string(theme.template, request)
+ theme.template_name = 'user_request_validated.html'
+ html_content = render_to_string(theme.template, request)
+
+ theme.template_name = 'email_default_sender.txt'
+ sender = render_to_string(theme.template, request)
+ sender = sender.replace('\n', '')
+
+
+ subject = 'User validated'
+
+ msg = EmailMultiAlternatives(subject, text_content, sender, [request['email']])
+ msg.attach_alternative(html_content, "text/html")
+ msg.send()
+ except Exception, e:
+ print "Failed to send email, please check the mail templates and the SMTP configuration of your server"
+
return results
def create_user(wsgi_request, request, namespace = None, as_admin = False):
diff --git a/portal/templates/slice-request-done-view.html b/portal/templates/slice-request-done-view.html
index 5a557055..9419d136 100644
--- a/portal/templates/slice-request-done-view.html
+++ b/portal/templates/slice-request-done-view.html
@@ -1,6 +1,6 @@
-{% extends "layout-unfold1.html" %}
+{% extends "layout.html" %}
-{% block unfold_main %}
+{% block content %}
Slice created
diff --git a/portal/templates/user_request_validated.html b/portal/templates/user_request_validated.html
new file mode 100644
index 00000000..8bb6ee2d
--- /dev/null
+++ b/portal/templates/user_request_validated.html
@@ -0,0 +1,16 @@
+
+
+Dear {{first_name}} {{last_name}},
+
+It is my pleasure to welcome you as a fully signed up user of the OneLab experimental facility. OneLab provides you with access to world class computer networking testbeds, such as IoT-LAB, NITOS, and PlanetLab Europe. Our aim at OneLab is to promote the use of these testbeds for pre-commercial research and development by industry, for scientific research, and for university level laboratory exercises.
+
+
+Your entry point for access to the testbeds is the OneLab portal, which provides a web-based interface for browsing and reserving resources on the various testbeds. To run an experiment using those resources, you may log in to the testbed and/or individual nodes on the testbed with your OneLab public/private key pair, or use an experiment control tool such as as NEPI or OMF. The OneLab operations team is standing by at support@onelab.eu to provide you with help regarding the portal and to refer your testbed- and tool-specific queries to those best able to answer them.
+
+
+On behalf of the entire team, I wish you a fruitful user experience on OneLab.
+
+Yours sincerely,
+
+Timur Friedman
+Executive Director
diff --git a/portal/templates/user_request_validated.txt b/portal/templates/user_request_validated.txt
new file mode 100644
index 00000000..a9f956aa
--- /dev/null
+++ b/portal/templates/user_request_validated.txt
@@ -0,0 +1,12 @@
+Dear {{first_name}} {{last_name}},
+
+It is my pleasure to welcome you as a fully signed up user of the OneLab experimental facility. OneLab provides you with access to world class computer networking testbeds, such as IoT-LAB, NITOS, and PlanetLab Europe. Our aim at OneLab is to promote the use of these testbeds for pre-commercial research and development by industry, for scientific research, and for university level laboratory exercises.
+
+Your entry point for access to the testbeds is the OneLab portal, which provides a web-based interface for browsing and reserving resources on the various testbeds. To run an experiment using those resources, you may log in to the testbed and/or individual nodes on the testbed with your OneLab public/private key pair, or use an experiment control tool such as as NEPI or OMF. The OneLab operations team is standing by at support@onelab.eu to provide you with help regarding the portal and to refer your testbed- and tool-specific queries to those best able to answer them.
+
+On behalf of the entire team, I wish you a fruitful user experience on OneLab.
+
+Yours sincerely,
+
+Timur Friedman
+Executive Director
--
2.43.0