fp7-ofelia / ocf

OFELIA Control Framework (OCF) is a set of software tools for testbed management.
http://fp7-ofelia.github.com/ocf/
Other
18 stars 14 forks source link

Email notifications links use IPs addresses instead of URLs #109

Closed lbergesio closed 11 years ago

lbergesio commented 11 years ago

Email notifications (at least the "you have been addedd to a project") link to an IP which may be in the management network and not reachable by the user. It should be replaced with the official domain name: http://exp.i2cat.fp7-ofelia.eu/

CarolinaFernandez commented 11 years ago

URL within the e-mail is obtained from localsettings. Therefore, SITE_DOMAIN must follow format url[:port] (yep, no http[s]:// inside).

This has been updated for both Expedient and Opt-in settings.

File: expedient/src/python/expedient/clearinghouse/project/views.py

def add_member(request, proj_id):
    (...)
    try:
        # Get project detail URL to send via e-mail
        from expedient.clearinghouse.project import urls
        project_detail_url = reverse("project_detail", args=[project.id]) or "/"
        # No "https://" check should be needed if settings are OK
        site_domain_url = "https://" + Site.objects.get_current().domain + project_detail_url
        send_mail(
                 settings.EMAIL_SUBJECT_PREFIX + "Project %s membership notification" % (project.name),
                 "You have been added to project '%s' as a user with the following roles: %s.\nYou may start experimenting now by going to %s\n\n" % (project.name, roles, site_domain_url),
                 from_email=settings.DEFAULT_FROM_EMAIL,
                 recipient_list=[user.email],
         )
    except Exception as e:
        print "User email notification could not be sent. Exception: %s" % str(e)