diff --git a/kfet/templates/kfet/base_nav.html b/kfet/templates/kfet/base_nav.html
index ecc8cf5d..24ecbd7a 100644
--- a/kfet/templates/kfet/base_nav.html
+++ b/kfet/templates/kfet/base_nav.html
@@ -35,12 +35,24 @@
Caisses
Articles
{% if request.user.username != 'kfet_genericteam' %}
- Connexion standard
+ Connexion standard
{% endif %}
{% endif %}
+ {% if request.user.is_authenticated %}
+
+ {% endif %}
+
diff --git a/kfet/views.py b/kfet/views.py
index d6e6d060..662de4b7 100644
--- a/kfet/views.py
+++ b/kfet/views.py
@@ -22,6 +22,7 @@ from collections import defaultdict
from channels import Group
from kfet import consumers
from datetime import timedelta
+import django_cas_ng
@login_required
def home(request):
@@ -29,10 +30,18 @@ def home(request):
@permission_required('kfet.is_team')
def login_genericteam(request):
+ profile, _ = CofProfile.objects.get_or_create(user=request.user)
+ logout_cas = ''
+ if profile.login_clipper:
+ logout_cas = django_cas_ng.views.logout(request)
+
token = GenericTeamToken.objects.create(token=get_random_string(50))
user = authenticate(username="kfet_genericteam", token=token.token)
login(request, user)
- print(request.user)
+
+ if logout_cas:
+ return logout_cas
+
return render(request, "kfet/login_genericteam.html")
def put_cleaned_data_in_dict(dict, form):