Merge branch 'thubrecht/connexion_vieux' into 'master'

Thubrecht/connexion vieux

See merge request klub-dev-ens/authens!26
This commit is contained in:
Martin Pepin 2021-01-28 20:41:15 +01:00
commit 82b2662636
4 changed files with 51 additions and 14 deletions

View file

@ -148,6 +148,12 @@ class OldCASBackend:
return return
try: try:
try:
cas_acc = CASAccount.objects.get(
cas_login=cas_login, entrance_year=entrance_year
)
user = cas_acc.user
except CASAccount.DoesNotExist:
old_cas_acc = OldCASAccount.objects.get( old_cas_acc = OldCASAccount.objects.get(
cas_login=cas_login, entrance_year=entrance_year cas_login=cas_login, entrance_year=entrance_year
) )

View file

@ -37,6 +37,22 @@ html, body {
flex-flow: row wrap; flex-flow: row wrap;
} }
#container-footer {
width: 100%;
background: #505160;
color: white;
}
#container-footer p {
padding: 5px;
font-weight: initial;
font-size: 1em;
margin: 0;
}
#container-footer a {
color: white;
}
/* /*
Background color definitions Background color definitions
*/ */

View file

@ -19,4 +19,10 @@
</a> </a>
{% endif %} {% endif %}
</div> </div>
{% if oldcas %}
<div id="container-footer">
{% url "authens:reset.pwd" as url_reset %}
<p>{% blocktrans %}Si votre fin de scolarité approche, créez un mot de passe pour votre compte pour bénéficier de la connexion vieilleux : <a href="{{ url_reset }}">créer un mot de passe</a>.{% endblocktrans %}</p>
</div>
{% endif %}
{% endblock %} {% endblock %}

View file

@ -123,3 +123,12 @@ class TestOldCASBackend(TestCase):
None, cas_login="johndoe", entrance_year=2014, password="password" None, cas_login="johndoe", entrance_year=2014, password="password"
) )
self.assertEqual(auth_user, user) self.assertEqual(auth_user, user)
def test_not_migrated_auth(self):
user = UserModel.objects.create_user(username="vieilleux", password="password")
CASAccount.objects.create(user=user, cas_login="vieilleux", entrance_year=2015)
auth_user = authenticate(
None, cas_login="vieilleux", entrance_year=2015, password="password"
)
self.assertEqual(auth_user, user)