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_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_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 dispatch(self, request, *args, **kwargs): if TenantApi.site_settings('DISABLE_SIGNUP', cast=bool, request=request): return redirect(reverse('login')) else: return super().dispatch(request, *args, **kwargs)
def get_template_names(self): if TenantApi.site_settings( 'DISABLE_SIGNUP', cast=bool, request=self.request, ): self.template_name = self.signup_disabled_template_name return super().get_template_names()
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 get_template_names(self): if TenantApi.site_settings( 'DISABLE_SIGNUP', cast=bool, request=self.request, ): self.template_name = 'callisto_core/accounts/login_signup_disabled.html' return super().get_template_names()
def non_school_email_error(request=None, site_id=None): return mark_safe(''' Please enter a valid {} student email. If you're getting this message and you think you shouldn't be, contact us at [email protected]. '''.format( TenantApi.site_settings('SCHOOL_SHORTNAME', request=request, site_id=site_id), ))
def email_field_placeholder(self): school_email_domain = TenantApi.site_settings( 'SCHOOL_EMAIL_DOMAIN', request=self.view.request, ) return { 'placeholder': ', '.join(['myname@' + x for x in school_email_domain.split(',')], ) }
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if TenantApi.site_settings("DISABLE_SIGNUP", cast=bool, request=self.request): label = "Email Address" else: label = "Username" self.fields["username"] = CharField( max_length=64, label=label, error_messages={"required": REQUIRED_ERROR.format(label)}, )
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) if TenantApi.site_settings( 'DISABLE_SIGNUP', cast=bool, request=self.request, ): label = 'Email Address' else: label = 'Username' self.fields['username'] = CharField( max_length=64, label=label, error_messages={'required': REQUIRED_ERROR.format(label)}, )
def validate_school_email(email, request=None, site_id=None): email_domain = email.rsplit('@', 1)[-1].lower() school_email_domain = TenantApi.site_settings( 'SCHOOL_EMAIL_DOMAIN', request=request, site_id=site_id, ) allowed = [_domain.strip() for _domain in school_email_domain.split(',')] allowed.append('projectcallisto.org') if email_domain not in allowed and not settings.DEBUG: logger.warning( "non school email used with domain {}".format(email_domain)) raise forms.ValidationError( non_school_email_error( request=request, site_id=site_id, ))
def school_name(self): return TenantApi.site_settings("SCHOOL_SHORTNAME", request=self.request)
def save(self, *args, **kwargs): kwargs['domain_override'] = TenantApi.get_current_domain() super().save(*args, **kwargs)
def save(self, *args, **kwargs): kwargs["domain_override"] = TenantApi.get_current_domain() super().save(*args, **kwargs)
def set_domain(self): self.context.update({'domain': TenantApi.get_current_domain()})
def school_name(self): return TenantApi.site_settings( 'SCHOOL_SHORTNAME', request=self.request)
def in_demo_mode(self): return TenantApi.site_settings( 'DEMO_MODE', request=self.request, cast=bool)
def coordinator_emails(self): return TenantApi.site_settings('COORDINATOR_EMAIL', request=self.request)
def coordinator_emails(self): return TenantApi.site_settings( 'COORDINATOR_EMAIL', request=self.request)
def in_demo_mode(self): return TenantApi.site_settings("DEMO_MODE", request=self.request, cast=bool)
def school_email_domain(self): return TenantApi.site_settings( 'SCHOOL_EMAIL_DOMAIN', request=self.request)
def coordinator_public_key(self): return TenantApi.site_settings( 'COORDINATOR_PUBLIC_KEY', request=self.request)
def school_email_domain(self): return TenantApi.site_settings("SCHOOL_EMAIL_DOMAIN", request=self.request)
def coordinator_public_key(self): return TenantApi.site_settings('COORDINATOR_PUBLIC_KEY', request=self.request)
def dispatch(self, request, *args, **kwargs): if TenantApi.site_settings( 'DISABLE_SIGNUP', cast=bool, request=request): return redirect(reverse('login')) else: return super().dispatch(request, *args, **kwargs)