Ejemplo n.º 1
0
 def _notify_owner_of_submission(self, identifier):
     if identifier:
         NotificationApi.send_confirmation(
             email_type='match_confirmation',
             to_addresses=[self.report.contact_email],
             site_id=self.site_id,
         )
Ejemplo n.º 2
0
 def _notify_authority_of_matches(self, matches, identifier):
     NotificationApi.send_matching_report_to_authority(
         matches=matches,
         identifier=identifier,
         to_addresses=self.coordinator_emails,
         public_key=self.coordinator_public_key,
     )
 def send_user_review_slack_notification(self):
     emails = TenantApi.site_settings(
         'COORDINATOR_EMAIL', site_id=self.site_id)
     NotificationApi.slack_notification(
         msg=f'Sent a encrypted PDF of report and match report information to {emails}',
         type='user_review',
     )
Ejemplo n.º 4
0
    def create_accounts(self):
        emails = self.emails.split(',')
        NotificationApi.slack_notification(
            f'Running bulk account creation for {len(emails)} accounts',
            channel='#launch')

        emails = [email.strip().lower() for email in emails if email]
        self.parsed_emails = emails
        logger.debug(self.parsed_emails)

        for email in emails:
            user, user_created = User.objects.get_or_create(username=email, )
            if user_created:
                user.set_password(User.objects.make_random_password())
                user.save()
            User.objects.filter(id=user.id).update(email=email, )

            account, _ = Account.objects.get_or_create(
                user_id=user.id,
                site_id=self.site_id,
            )
            Account.objects.filter(id=account.id).update(
                is_verified=True,
                school_email=email,
            )

            NotificationApi.send_account_activation_email(user, email)
Ejemplo n.º 5
0
 def _notify_authority_of_matches(self, matches, identifier):
     NotificationApi.send_matching_report_to_authority(
         matches=matches,
         identifier=identifier,
         to_addresses=self.coordinator_emails,
         public_key=self.coordinator_public_key,
     )
Ejemplo n.º 6
0
 def _notify_owner_of_submission(self, identifier):
     if identifier:
         NotificationApi.send_confirmation(
             email_type='match_confirmation',
             to_addresses=[self.report.contact_email],
             site_id=self.site_id,
         )
Ejemplo n.º 7
0
 def send_user_review_slack_notification(self):
     emails = TenantApi.site_settings('COORDINATOR_EMAIL',
                                      site_id=self.site_id)
     NotificationApi.slack_notification(
         msg=
         f'Sent a encrypted PDF of report and match report information to {emails}',
         type='user_review',
     )
Ejemplo n.º 8
0
 def _send_report_to_authority(self, report):
     NotificationApi.send_report_to_authority(
         sent_report=report,
         report_data=self.storage.cleaned_form_data,
         site_id=self.site_id,
         to_addresses=self.coordinator_emails,
         public_key=self.coordinator_public_key,
     )
Ejemplo n.º 9
0
 def send_user_review_email(self):
     NotificationApi.send_user_review_nofication(
         reports=self.reports,
         matches=self.matches,
         to_addresses=[TenantApi.site_settings('COORDINATOR_EMAIL', site_id=self.site_id)],
         public_key=TenantApi.site_settings('COORDINATOR_PUBLIC_KEY', site_id=self.site_id),
         site_id=self.site_id,
     )
Ejemplo n.º 10
0
 def _send_confirmation_email_to_callisto(self):
     if not self.in_demo_mode:
         NotificationApi.send_with_kwargs(
             site_id=self.site_id,  # required in general
             email_template_name=self.admin_email_template_name,  # the email template
             to_addresses=NotificationApi.ALERT_LIST,  # addresses to send to
             report=self.report,  # used in the email body
             email_subject='New Callisto Report',  # rendered as the email subject
         )
Ejemplo n.º 11
0
 def _send_confirmation_email(self):
     kwargs = {
         'email_type': 'submit_confirmation',
         'to_addresses': [self.report.contact_email],
         'site_id': self.site_id,
     }
     if self.in_demo_mode:
         kwargs['to_addresses'] += self.all_user_emails
     NotificationApi.send_confirmation(**kwargs)
Ejemplo n.º 12
0
 def _send_confirmation_email(self):
     kwargs = {
         "email_type": "submit_confirmation",
         "to_addresses": [self.report.contact_email],
         "site_id": self.site_id,
     }
     if self.in_demo_mode:
         kwargs["DEMO_MODE"] = True
         kwargs["to_addresses"] += self.all_user_emails
     NotificationApi.send_confirmation(**kwargs)
Ejemplo n.º 13
0
 def _send_mail(self, form):
     NotificationApi.send_with_kwargs(
         site_id=self.request.user.account.site_id,
         to_addresses=[form.cleaned_data.get('email')],
         email_subject='Verify your student email',
         email_name='student_verification_email',
         redirect_url=self.student_confirmation_url,
         email_template_name=self.email_template_name,
         user=self.request.user,
     )
Ejemplo n.º 14
0
 def _send_mail(self, form):
     NotificationApi.send_with_kwargs(
         site_id=self.request.user.account.site_id,
         to_addresses=[form.cleaned_data.get("email")],
         email_subject="Verify your student email",
         email_name="student_verification_email",
         redirect_url=self.student_confirmation_url,
         email_template_name=self.email_template_name,
         user=self.request.user,
     )
Ejemplo n.º 15
0
 def _match_confirmation_email_to_callisto(self, matches):
     if not self.in_demo_mode:
         NotificationApi.send_with_kwargs(
             site_id=self.site_id,  # required in general
             email_template_name=self.admin_email_template_name,  # the email template
             to_addresses=NotificationApi.ALERT_LIST,  # addresses to send to
             matches=matches,  # used in the email body
             email_subject='New Callisto Matches',  # rendered as the email subject
             email_name='match_confirmation_callisto_team',  # used in test assertions
         )
Ejemplo n.º 16
0
 def _send_report_to_authority(self, report):
     kwargs = {
         'sent_report': report,
         'report_data': self.storage.cleaned_form_data,
         'site_id': self.site_id,
         'to_addresses': [self.coordinator_emails],
         'public_key': self.coordinator_public_key,
     }
     if self.in_demo_mode:
         kwargs['to_addresses'] += self.all_user_emails
     NotificationApi.send_report_to_authority(**kwargs)
Ejemplo n.º 17
0
 def _send_report_to_authority(self, report):
     kwargs = {
         "sent_report": report,
         "report_data": self.storage.cleaned_form_data,
         "site_id": self.site_id,
         "to_addresses": [self.coordinator_emails],
         "public_key": self.coordinator_public_key,
     }
     print(kwargs)
     if self.in_demo_mode:
         kwargs["DEMO_MODE"] = True
         kwargs["to_addresses"] += self.all_user_emails
     NotificationApi.send_report_to_authority(**kwargs)
 def send_user_review_email(self):
     NotificationApi.send_user_review_nofication(
         reports=self.reports,
         matches=self.matches,
         to_addresses=[
             TenantApi.site_settings(
                 'COORDINATOR_EMAIL',
                 site_id=self.site_id)],
         public_key=TenantApi.site_settings(
             'COORDINATOR_PUBLIC_KEY',
             site_id=self.site_id),
         site_id=self.site_id,
     )
Ejemplo n.º 19
0
    def create_accounts(self):
        emails = self.emails.split(',')
        NotificationApi.slack_notification(
            f'Running bulk account creation for {len(emails)} accounts',
            channel='#launch'
        )

        emails = [
            email.strip().lower()
            for email in emails
            if email
        ]
        self.parsed_emails = emails
        logger.debug(self.parsed_emails)

        for email in emails:
            user, user_created = User.objects.get_or_create(
                username=email,
            )
            if user_created:
                user.set_password(User.objects.make_random_password())
                user.save()
            User.objects.filter(id=user.id).update(
                email=email,
            )

            account, _ = Account.objects.get_or_create(
                user_id=user.id,
                site_id=self.site_id,
            )
            Account.objects.filter(id=account.id).update(
                is_verified=True,
                school_email=email,
            )

            NotificationApi.send_account_activation_email(user, email)
Ejemplo n.º 20
0
 def _slack_match_notification(self):
     if not self.in_demo_mode:
         NotificationApi.slack_notification(
             msg="New Callisto Matches (details will be sent via email)",
             type="match_confirmation",
         )
Ejemplo n.º 21
0
 def _send_confirmation_email(self):
     NotificationApi.send_confirmation(
         email_type='submit_confirmation',
         to_addresses=[self.report.contact_email],
         site_id=self.site_id,
     )
Ejemplo n.º 22
0
 def _send_confirmation_slack_notification(self):
     NotificationApi.slack_notification(
         msg='New Callisto Report (details will be sent via email)',
         type='submit_confirmation',
     )
Ejemplo n.º 23
0
 def _notify_owners_of_matches(self, matches):
     for match in matches:
         NotificationApi.send_match_notification(match_report=match, )
Ejemplo n.º 24
0
 def send_mail(self):
     self.redirect_url = self._get_confirmation_url()
     NotificationApi.send_student_verification_email(self)
Ejemplo n.º 25
0
 def _notify_owners_of_matches(self, matches):
     for match in matches:
         NotificationApi.send_match_notification(
             match_report=match,
         )
Ejemplo n.º 26
0
 def _slack_match_notification(self):
     if not self.in_demo_mode:
         NotificationApi.slack_notification(
             msg='New Callisto Matches (details will be sent via email)',
             type='match_confirmation',
         )
Ejemplo n.º 27
0
 def _slack_match_notification(self):
     NotificationApi.slack_notification(
         msg='New Callisto Matches (details will be sent via email)',
         type='match_confirmation',
     )
Ejemplo n.º 28
0
 def send_mail(self, *args, **kwargs):
     NotificationApi.send_password_reset_email(self, *args, **kwargs)
Ejemplo n.º 29
0
 def send_mail(self, *args, **kwargs):
     NotificationApi.send_password_reset_email(self, *args, **kwargs)
Ejemplo n.º 30
0
 def _send_confirmation_slack_notification(self):
     if not self.in_demo_mode:
         NotificationApi.slack_notification(
             msg=self.SLACK_ALERT_TEXT,
             type='submit_confirmation',
         )
Ejemplo n.º 31
0
 def _send_confirmation_slack_notification(self):
     if not self.in_demo_mode:
         NotificationApi.slack_notification(
             msg=self.SLACK_ALERT_TEXT.format(school_name=self.school_name),
             type="submit_confirmation",
         )