예제 #1
0
파일: tests.py 프로젝트: NathHense/itou
    def test_validate(self):

        # Good passwords.

        # lower + upper + special char
        self.assertIsNone(
            CnilCompositionPasswordValidator().validate("!*pAssWOrD"))
        # lower + upper + digit
        self.assertIsNone(
            CnilCompositionPasswordValidator().validate("MYp4ssW0rD"))
        # lower + upper + digit + special char
        self.assertIsNone(
            CnilCompositionPasswordValidator().validate("M+p4ssW0rD"))

        # Wrong passwords.

        expected_error = CnilCompositionPasswordValidator.HELP_MSG

        with self.assertRaises(ValidationError) as error:
            # Only lower + upper
            CnilCompositionPasswordValidator().validate("MYpAssWOrD")
        self.assertEqual(error.exception.messages, [expected_error])
        self.assertEqual(error.exception.error_list[0].code,
                         "cnil_composition")

        with self.assertRaises(ValidationError) as error:
            # Only lower + digit
            CnilCompositionPasswordValidator().validate("myp4ssw0rd")
        self.assertEqual(error.exception.messages, [expected_error])
        self.assertEqual(error.exception.error_list[0].code,
                         "cnil_composition")
예제 #2
0
 def __init__(self, *args, **kwargs):
     self.pole_emploi_org = kwargs.pop("pole_emploi_org")
     super().__init__(*args, **kwargs)
     self.fields["password1"].help_text = CnilCompositionPasswordValidator(
     ).get_help_text()
     self.fields[
         "email"].help_text = f"Exemple : nom.prenom{settings.POLE_EMPLOI_EMAIL_SUFFIX}"
예제 #3
0
    def __init__(self, nir, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.nir = nir
        self.fields["nir"].initial = self.nir
        self.fields["password1"].help_text = CnilCompositionPasswordValidator(
        ).get_help_text()
        for password_field in [
                self.fields["password1"], self.fields["password2"]
        ]:
            password_field.widget.attrs["placeholder"] = "**********"
        self.fields["email"].widget.attrs["placeholder"] = "*****@*****.**"
        self.fields["email"].label = "Adresse e-mail"
        self.fields["first_name"].widget.attrs["placeholder"] = "Dominique"
        self.fields["last_name"].widget.attrs["placeholder"] = "Durand"
        self.fields["password1"].help_text = (
            CnilCompositionPasswordValidator().get_help_text() + " " +
            FRANCE_CONNECT_PASSWORD_EXPLANATION)
예제 #4
0
 def __init__(self, *args, **kwargs):
     self.authorization_status = kwargs.pop("authorization_status")
     self.kind = kwargs.pop("kind")
     self.prescriber_org_data = kwargs.pop("prescriber_org_data")
     super().__init__(*args, **kwargs)
     self.fields["password1"].help_text = CnilCompositionPasswordValidator(
     ).get_help_text()
     self.fields[
         "email"].help_text = "Utilisez une adresse e-mail professionnelle."
예제 #5
0
파일: forms.py 프로젝트: NathHense/itou
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.organization = None
     self.new_organization = None
     self.fields["email"].widget.attrs["placeholder"] = _(
         "Adresse e-mail professionnelle")
     self.fields["email"].help_text = _(
         "Utilisez plutôt votre adresse e-mail professionnelle, "
         "cela nous permettra de vous identifier plus facilement comme membre de votre structure."
     )
     self.fields["password1"].help_text = CnilCompositionPasswordValidator(
     ).get_help_text()
예제 #6
0
파일: forms.py 프로젝트: NathHense/itou
 def __init__(self, *args, **kwargs):
     super(SiaeSignupForm, self).__init__(*args, **kwargs)
     self.fields["email"].widget.attrs["placeholder"] = _(
         "Adresse e-mail professionnelle")
     self.fields["email"].help_text = _(
         "Utilisez plutôt votre adresse e-mail professionnelle, "
         "cela nous permettra de vous identifier plus facilement comme membre de cette structure."
     )
     self.fields["kind"].widget.attrs["readonly"] = True
     self.fields["password1"].help_text = CnilCompositionPasswordValidator(
     ).get_help_text()
     self.fields["siret"].widget.attrs["readonly"] = True
     self.fields["siae_name"].widget.attrs["readonly"] = True
예제 #7
0
파일: forms.py 프로젝트: NathHense/itou
 def __init__(self, *args, **kwargs):
     super(JobSeekerSignupForm, self).__init__(*args, **kwargs)
     self.fields["password1"].help_text = CnilCompositionPasswordValidator(
     ).get_help_text()
예제 #8
0
파일: tests.py 프로젝트: NathHense/itou
 def test_help_text(self):
     self.assertEqual(CnilCompositionPasswordValidator().get_help_text(),
                      CnilCompositionPasswordValidator.HELP_MSG)