コード例 #1
0
def send_request_email(authorised_text, authorised_role, authorised_persons,
                       application, link, is_secret):
    """Sends an email to admin asking to approve user application"""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = link
    context['is_secret'] = is_secret
    context['application'] = application
    context['authorised_text'] = authorised_text
    _send_request_email(context, authorised_role, authorised_persons,
                        "common_request")
コード例 #2
0
def send_duplicate_email(authorised_text, authorised_role, authorised_persons,
                         application, link, is_secret):
    """Sends an email to admin to warn application was marked duplicate."""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = link
    context['is_secret'] = is_secret
    context['application'] = application
    context['authorised_text'] = authorised_text
    _send_request_email(context, authorised_role, authorised_persons,
                        "project_duplicate_applicant")
コード例 #3
0
ファイル: emails.py プロジェクト: NeCTAR-RC/karaage
def send_reset_password_email(person):
    """Sends an email to user allowing them to set their password."""
    context = CONTEXT.copy()
    context.update({
        'url': person.get_password_reset_url(),
        'receiver': person,
    })

    to_email = person.email
    subject, body = render_email('reset_password', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #4
0
ファイル: emails.py プロジェクト: NeCTAR-RC/karaage
def send_confirm_password_email(person):
    """Sends an email to user allowing them to confirm their password."""

    context = CONTEXT.copy()
    context.update({
        'url': '%s/users/%s/login/' % (settings.REGISTRATION_BASE_URL, person.username),
        'receiver': person,
    })

    to_email = person.email
    subject, body = render_email('confirm_password', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #5
0
def send_request_email(
        authorised_text, authorised_role, authorised_persons, application,
        link, is_secret):
    """Sends an email to admin asking to approve user application"""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = link
    context['is_secret'] = is_secret
    context['application'] = application
    context['authorised_text'] = authorised_text
    _send_request_email(
        context,
        authorised_role, authorised_persons,
        "common_request")
コード例 #6
0
def send_duplicate_email(
        authorised_text, authorised_role, authorised_persons, application,
        link, is_secret):
    """Sends an email to admin to warn application was marked duplicate."""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = link
    context['is_secret'] = is_secret
    context['application'] = application
    context['authorised_text'] = authorised_text
    _send_request_email(
        context,
        authorised_role, authorised_persons,
        "project_duplicate_applicant")
コード例 #7
0
def send_user_request_email(name, application, request_type, project_name):
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['application'] = application
    context['request_type'] = request_type
    context['project_name'] = project_name
    template_name = "user_request_" + name

    if application.applicant and application.applicant.email:

        context['receiver'] = application.applicant
        to_email = application.applicant.email
        subject, body = render_email(template_name, context)

        send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #8
0
def send_confirm_password_email(person):
    """Sends an email to user allowing them to confirm their password."""
    url = '%s/profile/login/%s/' % (
        settings.REGISTRATION_BASE_URL, person.username)

    context = CONTEXT.copy()
    context.update({
        'url': url,
        'receiver': person,
    })

    to_email = person.email
    subject, body = render_email('confirm_password', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #9
0
ファイル: emails.py プロジェクト: CVL-GitHub/karaage
def send_user_request_email(name, application, request_type, project_name):
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['application'] = application
    context['request_type'] = request_type 
    context['project_name'] = project_name 
    template_name = "user_request_" + name

    if application.applicant and application.applicant.email:

        context['receiver'] = application.applicant
        to_email = application.applicant.email
        subject, body = render_email(template_name, context)

        send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #10
0
def send_invite_email(application, link, is_secret):
    """ Sends an email inviting someone to create an account"""

    if not application.applicant.email:
        return

    context = CONTEXT.copy()
    context['receiver'] = application.applicant
    context['application'] = application
    context['link'] = link
    context['is_secret'] = is_secret

    to_email = application.applicant.email
    subject, body = render_email('common_invite', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #11
0
ファイル: emails.py プロジェクト: NeCTAR-RC/karaage
def send_approved_email(application, created_person, created_account, link, is_secret):
    """Sends an email informing person application is approved"""
    if not application.applicant.email:
        return

    context = CONTEXT.copy()
    context['receiver'] = application.applicant
    context['application'] = application
    context['created_person'] = created_person
    context['created_account'] = created_account
    context['link'] = link
    context['is_secret'] = is_secret
    subject, body = render_email('common_approved', context)
    to_email = application.applicant.email

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #12
0
def send_invite_email(application, link, is_secret):
    """ Sends an email inviting someone to create an account"""

    if not application.applicant.email:
        return

    context = CONTEXT.copy()
    context['receiver'] = application.applicant
    context['application'] = application
    context['link'] = link
    context['is_secret'] = is_secret

    to_email = application.applicant.email
    subject, body = render_email('common_invite', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #13
0
def send_reset_password_email(person):
    """Sends an email to user allowing them to set their password."""
    uid = urlsafe_base64_encode(force_bytes(person.pk))
    token = default_token_generator.make_token(person)
    url = '%s/persons/reset/%s/%s/' % (
        settings.REGISTRATION_BASE_URL, uid, token)

    context = CONTEXT.copy()
    context.update({
        'url': url,
        'receiver': person,
    })

    to_email = person.email
    subject, body = render_email('reset_password', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #14
0
def send_reset_password_email(person):
    """Sends an email to user allowing them to set their password."""
    uid = urlsafe_base64_encode(force_bytes(person.pk)).decode("ascii")
    token = default_token_generator.make_token(person)
    url = '%s/persons/reset/%s/%s/' % (
        settings.REGISTRATION_BASE_URL, uid, token)

    context = CONTEXT.copy()
    context.update({
        'url': url,
        'receiver': person,
    })

    to_email = person.email
    subject, body = render_email('reset_password', context)

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #15
0
def send_approved_email(application, created_person, created_account, link,
                        is_secret):
    """Sends an email informing person application is approved"""
    if not application.applicant.email:
        return

    context = CONTEXT.copy()
    context['receiver'] = application.applicant
    context['application'] = application
    context['created_person'] = created_person
    context['created_account'] = created_account
    context['link'] = link
    context['is_secret'] = is_secret
    subject, body = render_email('common_approved', context)
    to_email = application.applicant.email

    send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #16
0
ファイル: emails.py プロジェクト: NeCTAR-RC/karaage
def send_bounced_warning(person):
    """Sends an email to each project leader for person
    informing them that person's email has bounced"""
    context = CONTEXT.copy()
    context['person'] = person

    for project in person.project_set.all():
        if project.is_active:
            context['project'] = project
            for leader in project.leaders.all():
                context['receiver'] = leader

                to_email = leader.email
                subject = render_to_string('people/emails/bounced_email_subject.txt', context)
                body = render_to_string('people/emails/bounced_email_body.txt', context)
                send_mail(subject.replace('\n', ''), body, settings.ACCOUNTS_EMAIL, [to_email])
                log(None, leader, 2, 'Sent email about bounced emails from %s' % person)
コード例 #17
0
ファイル: emails.py プロジェクト: NeCTAR-RC/karaage
def send_request_email(authorised_text, authorised_persons, application):
    """Sends an email to admin asking to approve user application"""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = '%s/applications/%d/' % (settings.REGISTRATION_BASE_URL, application.pk)
    context['application'] = application
    context['authorised_text'] = authorised_text

    for person in authorised_persons:
        if not person.email:
            continue

        context['receiver'] = person

        to_email = person.email
        subject, body = render_email('common_request', context)

        send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #18
0
def send_request_email(authorised_text, authorised_persons, application, link, is_secret):
    """Sends an email to admin asking to approve user application"""
    context = CONTEXT.copy()
    context["requester"] = application.applicant
    context["link"] = link
    context["is_secret"] = is_secret
    context["application"] = application
    context["authorised_text"] = authorised_text

    for person in authorised_persons:
        if not person.email:
            continue

        context["receiver"] = person

        to_email = person.email
        subject, body = render_email("common_request", context)

        send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #19
0
def send_bounced_warning(person, leader_list):
    """Sends an email to each project leader for person
    informing them that person's email has bounced"""
    context = CONTEXT.copy()
    context['person'] = person

    for lp in leader_list:
        leader = lp['leader']

        context['project'] = lp['project']
        context['receiver'] = leader

        to_email = leader.email
        subject = render_to_string(
            'karaage/people/emails/bounced_email_subject.txt', context)
        body = render_to_string('karaage/people/emails/bounced_email_body.txt',
                                context)
        send_mail(subject.replace('\n', ''), body, settings.ACCOUNTS_EMAIL,
                  [to_email])
        log.change(leader, 'Sent email about bounced emails from %s' % person)
コード例 #20
0
def send_request_email(authorised_text, authorised_persons, application, link,
                       is_secret):
    """Sends an email to admin asking to approve user application"""
    context = CONTEXT.copy()
    context['requester'] = application.applicant
    context['link'] = link
    context['is_secret'] = is_secret
    context['application'] = application
    context['authorised_text'] = authorised_text

    for person in authorised_persons:
        if not person.email:
            continue

        context['receiver'] = person

        to_email = person.email
        subject, body = render_email('common_request', context)

        send_mail(subject, body, settings.ACCOUNTS_EMAIL, [to_email])
コード例 #21
0
def send_bounced_warning(person, leader_list):
    """Sends an email to each project leader for person
    informing them that person's email has bounced"""
    context = CONTEXT.copy()
    context['person'] = person

    for lp in leader_list:
        leader = lp['leader']

        context['project'] = lp['project']
        context['receiver'] = leader

        to_email = leader.email
        subject = render_to_string(
            'karaage/people/emails/bounced_email_subject.txt', context)
        body = render_to_string(
            'karaage/people/emails/bounced_email_body.txt', context)
        send_mail(
            subject.replace('\n', ''), body,
            settings.ACCOUNTS_EMAIL, [to_email])
        log.change(
            leader,
            'Sent email about bounced emails from %s' % person)