コード例 #1
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,
     )
コード例 #2
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,
     )
コード例 #3
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',
     )
コード例 #4
0
 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)
コード例 #5
0
 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()
コード例 #6
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',
     )
コード例 #7
0
 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()
コード例 #8
0
 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()
コード例 #9
0
ファイル: validators.py プロジェクト: ktschap/callisto-core
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), ))
コード例 #10
0
 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(',')], )
     }
コード例 #11
0
ファイル: forms.py プロジェクト: siddhantgupta3/callisto-core
 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)},
     )
コード例 #12
0
 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)},
     )
コード例 #13
0
 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)},
     )
コード例 #14
0
ファイル: validators.py プロジェクト: ktschap/callisto-core
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,
            ))
コード例 #15
0
 def school_name(self):
     return TenantApi.site_settings("SCHOOL_SHORTNAME",
                                    request=self.request)
コード例 #16
0
 def save(self, *args, **kwargs):
     kwargs['domain_override'] = TenantApi.get_current_domain()
     super().save(*args, **kwargs)
コード例 #17
0
ファイル: forms.py プロジェクト: siddhantgupta3/callisto-core
 def save(self, *args, **kwargs):
     kwargs["domain_override"] = TenantApi.get_current_domain()
     super().save(*args, **kwargs)
コード例 #18
0
 def set_domain(self):
     self.context.update({'domain': TenantApi.get_current_domain()})
コード例 #19
0
 def school_name(self):
     return TenantApi.site_settings(
         'SCHOOL_SHORTNAME', request=self.request)
コード例 #20
0
ファイル: view_partials.py プロジェクト: ojshaw/callisto-core
 def in_demo_mode(self):
     return TenantApi.site_settings(
         'DEMO_MODE', request=self.request, cast=bool)
コード例 #21
0
 def coordinator_emails(self):
     return TenantApi.site_settings('COORDINATOR_EMAIL',
                                    request=self.request)
コード例 #22
0
ファイル: view_partials.py プロジェクト: ojshaw/callisto-core
 def coordinator_emails(self):
     return TenantApi.site_settings(
         'COORDINATOR_EMAIL', request=self.request)
コード例 #23
0
 def in_demo_mode(self):
     return TenantApi.site_settings("DEMO_MODE",
                                    request=self.request,
                                    cast=bool)
コード例 #24
0
ファイル: view_partials.py プロジェクト: ojshaw/callisto-core
 def school_email_domain(self):
     return TenantApi.site_settings(
         'SCHOOL_EMAIL_DOMAIN', request=self.request)
コード例 #25
0
ファイル: view_partials.py プロジェクト: ojshaw/callisto-core
 def coordinator_public_key(self):
     return TenantApi.site_settings(
         'COORDINATOR_PUBLIC_KEY', request=self.request)
コード例 #26
0
ファイル: api.py プロジェクト: orx00/callisto-coregroup
 def set_domain(self):
     self.context.update({'domain': TenantApi.get_current_domain()})
コード例 #27
0
 def school_email_domain(self):
     return TenantApi.site_settings("SCHOOL_EMAIL_DOMAIN",
                                    request=self.request)
コード例 #28
0
 def coordinator_public_key(self):
     return TenantApi.site_settings('COORDINATOR_PUBLIC_KEY',
                                    request=self.request)
コード例 #29
0
 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)