Commit 74f643ad authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

remove hardcoded service name & use site.name instead of SERVICE_NAME setting

Refs: #1914
Refs: #1912
parent af4eb974
...@@ -308,16 +308,16 @@ def pending_users(request, template_name='pending_users.html', extra_context={}) ...@@ -308,16 +308,16 @@ def pending_users(request, template_name='pending_users.html', extra_context={})
context_instance = get_context(request, extra_context,**kwargs)) context_instance = get_context(request, extra_context,**kwargs))
def _send_greeting(request, user, template_name): def _send_greeting(request, user, template_name):
subject = _('Welcome to %s' %settings.SERVICE_NAME)
site = Site.objects.get_current() site = Site.objects.get_current()
subject = _('Welcome to %s' % site.name)
baseurl = request.build_absolute_uri('/').rstrip('/') baseurl = request.build_absolute_uri('/').rstrip('/')
message = render_to_string(template_name, { message = render_to_string(template_name, {
'user': user, 'user': user,
'url': site.domain, 'url': site.domain,
'baseurl': baseurl, 'baseurl': baseurl,
'site_name': site.name, 'site_name': site.name,
'support': settings.DEFAULT_CONTACT_EMAIL}) 'support': settings.DEFAULT_CONTACT_EMAIL % site.name.lower()})
sender = settings.DEFAULT_FROM_EMAIL sender = settings.DEFAULT_FROM_EMAIL % site.name
send_mail(subject, message, sender, [user.email]) send_mail(subject, message, sender, [user.email])
logging.info('Sent greeting %s', user) logging.info('Sent greeting %s', user)
......
...@@ -220,7 +220,7 @@ def _send_verification(request, user, template_name): ...@@ -220,7 +220,7 @@ def _send_verification(request, user, template_name):
'url': url, 'url': url,
'baseurl': baseurl, 'baseurl': baseurl,
'site_name': site.name, 'site_name': site.name,
'support': settings.DEFAULT_CONTACT_EMAIL}) 'support': settings.DEFAULT_CONTACT_EMAIL % site.name.lower()})
sender = settings.DEFAULT_FROM_EMAIL sender = settings.DEFAULT_FROM_EMAIL % site.name
send_mail('Pithos account activation', message, sender, [user.email]) send_mail('%s account activation' % site.name, message, sender, [user.email])
logging.info('Sent activation %s', user) logging.info('Sent activation %s', user)
...@@ -122,16 +122,16 @@ def _generate_invitation_code(): ...@@ -122,16 +122,16 @@ def _generate_invitation_code():
return code return code
def _send_invitation(request, baseurl, inv): def _send_invitation(request, baseurl, inv):
subject = _('Invitation to Astakos')
site = Site.objects.get_current() site = Site.objects.get_current()
subject = _('Invitation to %s' % site.name)
url = settings.SIGNUP_TARGET % (baseurl, inv.code, quote(site.domain)) url = settings.SIGNUP_TARGET % (baseurl, inv.code, quote(site.domain))
message = render_to_string('invitation.txt', { message = render_to_string('invitation.txt', {
'invitation': inv, 'invitation': inv,
'url': url, 'url': url,
'baseurl': baseurl, 'baseurl': baseurl,
'service': site.name, 'service': site.name,
'support': settings.DEFAULT_CONTACT_EMAIL}) 'support': settings.DEFAULT_CONTACT_EMAIL % site.name.lower()})
sender = settings.DEFAULT_FROM_EMAIL sender = settings.DEFAULT_FROM_EMAIL % site.name
send_mail(subject, message, sender, [inv.username]) send_mail(subject, message, sender, [inv.username])
logging.info('Sent invitation %s', inv) logging.info('Sent invitation %s', inv)
...@@ -343,7 +343,7 @@ def send_feedback(request, template_name='feedback.html', email_template_name='f ...@@ -343,7 +343,7 @@ def send_feedback(request, template_name='feedback.html', email_template_name='f
**Settings:** **Settings:**
* FEEDBACK_CONTACT_EMAIL: List of feedback recipients * DEFAULT_CONTACT_EMAIL: List of feedback recipients
""" """
if request.method == 'GET': if request.method == 'GET':
form = FeedbackForm() form = FeedbackForm()
...@@ -353,9 +353,10 @@ def send_feedback(request, template_name='feedback.html', email_template_name='f ...@@ -353,9 +353,10 @@ def send_feedback(request, template_name='feedback.html', email_template_name='f
form = FeedbackForm(request.POST) form = FeedbackForm(request.POST)
if form.is_valid(): if form.is_valid():
subject = _("Feedback from Okeanos") site = Site.objects.get_current()
subject = _("Feedback from %s" % site.name)
from_email = request.user.email from_email = request.user.email
recipient_list = [settings.FEEDBACK_CONTACT_EMAIL] recipient_list = [settings.DEFAULT_CONTACT_EMAIL]
content = render_to_string(email_template_name, { content = render_to_string(email_template_name, {
'message': form.cleaned_data('feedback_msg'), 'message': form.cleaned_data('feedback_msg'),
'data': form.cleaned_data('feedback_data'), 'data': form.cleaned_data('feedback_data'),
......
...@@ -20,12 +20,9 @@ INVITATIONS_PER_LEVEL = { ...@@ -20,12 +20,9 @@ INVITATIONS_PER_LEVEL = {
4 : 0 4 : 0
} }
SERVICE_NAME = 'Astakos'
# Address to use for outgoing emails # Address to use for outgoing emails
DEFAULT_FROM_EMAIL = '%s <no-reply@grnet.gr>' %SERVICE_NAME DEFAULT_FROM_EMAIL = '%s <no-reply@grnet.gr>'
DEFAULT_CONTACT_EMAIL = 'support@%s.grnet.gr' %SERVICE_NAME.lower() DEFAULT_CONTACT_EMAIL = 'support@%s.grnet.gr'
FEEDBACK_CONTACT_EMAIL = DEFAULT_CONTACT_EMAIL
# Where users should signup with their invitation code # Where users should signup with their invitation code
SIGNUP_TARGET = '%s/im/signup/?code=%d&next=%s' SIGNUP_TARGET = '%s/im/signup/?code=%d&next=%s'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment