diff --git a/flowspec/views.py b/flowspec/views.py index bb48d819f32e985f6d54b8debb6b94103c57c8ff..6ba6fa7669e39fe3b3f43d208045848e5e37adc5 100644 --- a/flowspec/views.py +++ b/flowspec/views.py @@ -374,9 +374,14 @@ def user_login(request): def user_activation_notify(user): current_site = Site.objects.get_current() + peer = user.get_profile().peer + + + # Email subject *must not* contain newlines + # TechCs will be notified about new users. + # Platform admins will activate the users. subject = render_to_string('registration/activation_email_subject.txt', { 'site': current_site }) - # Email subject *must not* contain newlines subject = ''.join(subject.splitlines()) registration_profile = RegistrationProfile.objects.create_profile(user) message = render_to_string('registration/activation_email.txt', @@ -384,6 +389,20 @@ def user_activation_notify(user): 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS, 'site': current_site, 'user': user }) + if settings.NOTIFY_ADMIN_MAILS: + admin_mails = settings.NOTIFY_ADMIN_MAILS + send_new_mail(settings.EMAIL_SUBJECT_PREFIX + subject, + message, settings.SERVER_EMAIL, + admin_mails, []) + + # Mail to domain techCs plus platform admins (no activation hash sent) + subject = render_to_string('registration/activation_email_peer_notify_subject.txt', + { 'site': current_site, + 'peer': peer }) + subject = ''.join(subject.splitlines()) + message = render_to_string('registration/activation_email_peer_notify.txt', + { 'user': user, + 'peer': peer }) send_new_mail(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, get_peer_techc_mails(user), []) @@ -495,7 +514,6 @@ def get_peer_techc_mails(user): techmails_list.append(techmail.email) if settings.NOTIFY_ADMIN_MAILS: additional_mail = settings.NOTIFY_ADMIN_MAILS -# mail.extend(user_mail) mail.extend(additional_mail) mail.extend(techmails_list) return mail diff --git a/templates/registration/activation_email_peer_notify.txt b/templates/registration/activation_email_peer_notify.txt new file mode 100644 index 0000000000000000000000000000000000000000..b9087d4c2b7cf494cdf16fc4095bfaa689951b9b --- /dev/null +++ b/templates/registration/activation_email_peer_notify.txt @@ -0,0 +1,23 @@ +Ξ/H {{ user.get_full_name }} ΞΞΊΞ±Ξ½Ξ΅ Ξ±Ξ―ΟΞ·ΟΞ· Ξ³ΞΉΞ± Ξ½Ξ΅Ο Ξ»ΞΏΞ³Ξ±ΟΞΉΞ±ΟΞΌΟ ΟΟΞ·Ξ½ Ο ΟΞ·ΟΞ΅ΟΞ―Ξ± Firewall On Demand +Ρκ ΞΌΞΟΞΏΟ Ο ΟΞΏΟ ΞΉΞ΄ΟΟΞΌΞ±ΟΞΏΟ/ΟΞΏΟΞΞ±: {{peer}}. + +ΞΞ½ΞΏΞΌΞ± ΟΟΞ�ΟΟΞ·: {{ user.username }} +E-mail: {{ user.email }} + +Ξ ΟΟΞ�ΟΟΞ·Ο ΞΈΞ± ΡνημΡΟΟθΡί Ξ³ΞΉΞ± ΟΞ·Ξ½ ΡνΡΟΞ³ΞΏΟΞΏΞ―Ξ·ΟΞ· ΟΞΏΟ Ξ»ΞΏΞ³Ξ±ΟΞΉΞ±ΟΞΌΞΏΟ ΟΞΏΟ ΞΌΞΟΟ e-mail. + +ΣΡ ΟΞ΅ΟΞ―ΟΟΟΟΞ· ΟΞΏΟ ΞΏ ΟΟΞ�ΟΟΞ·Ο Ξ΄Ξ΅Ξ½ Ξ±Ξ½Ξ�κΡι ΟΟΞΏ Ξ―Ξ΄ΟΟ ΞΌΞ±/ΟΞΏΟΞΞ± ΟΞ±Ο Ξ� ΟΟΞ·ΟΞΉΞΌΞΏΟοιΡί ΟΞ·Ξ½ Ο ΟΞ·ΟΞ΅ΟΞ―Ξ± ΡνάνΟΞΉΞ± ΟΟΞΏΞ½ +Ξ΅ΟΟΟΞ΅ΟΞΉΞΊΟ ΟΞ±Ο ΞΊΞ±Ξ½ΞΏΞ½ΞΉΟΞΌΟ ΟΞ±ΟακαλοΟΞΌΞ΅ Ξ΅ΟΞΉΞΊΞΏΞΉΞ½ΟΞ½Ξ�ΟΟΞ΅ άμΡΟΞ± ΞΌΞ±ΞΆΞ― ΞΌΞ±Ο. + +----------------------------------------------------------------------------- + +{{ user.get_full_name }} has registered for a new Firewall on Demand account on behalf of your +institution: {{peer}}. + +Username: {{user.username}} +E-mail: {{user.email}} + +The user will be notified via mail about the account activation + +In case this user does not belong to your institution or attempts to use the service without being +compliant to your instututions' regulation please contact us. diff --git a/templates/registration/activation_email_peer_notify_subject.txt b/templates/registration/activation_email_peer_notify_subject.txt new file mode 100644 index 0000000000000000000000000000000000000000..2f7f3408dbc488d77ba6ccc4bcd77339eb94cba8 --- /dev/null +++ b/templates/registration/activation_email_peer_notify_subject.txt @@ -0,0 +1 @@ +GRNET Firewall on Demand new account registration at {{ site.name }} on behalf of {{peer}}