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, )
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', )
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)
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', )
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, )
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, )
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 )
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)
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)
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, )
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, )
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 )
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)
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, )
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)
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", )
def _send_confirmation_email(self): NotificationApi.send_confirmation( email_type='submit_confirmation', to_addresses=[self.report.contact_email], site_id=self.site_id, )
def _send_confirmation_slack_notification(self): NotificationApi.slack_notification( msg='New Callisto Report (details will be sent via email)', type='submit_confirmation', )
def _notify_owners_of_matches(self, matches): for match in matches: NotificationApi.send_match_notification(match_report=match, )
def send_mail(self): self.redirect_url = self._get_confirmation_url() NotificationApi.send_student_verification_email(self)
def _notify_owners_of_matches(self, matches): for match in matches: NotificationApi.send_match_notification( match_report=match, )
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', )
def _slack_match_notification(self): NotificationApi.slack_notification( msg='New Callisto Matches (details will be sent via email)', type='match_confirmation', )
def send_mail(self, *args, **kwargs): NotificationApi.send_password_reset_email(self, *args, **kwargs)
def _send_confirmation_slack_notification(self): if not self.in_demo_mode: NotificationApi.slack_notification( msg=self.SLACK_ALERT_TEXT, type='submit_confirmation', )
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", )