minor fix

This commit is contained in:
Aurélien Delobelle 2017-05-31 22:00:51 +02:00
parent 8c6d56b27c
commit 6e82a2cf88
2 changed files with 5 additions and 8 deletions

View file

@ -15,11 +15,10 @@ class COFCASBackend(CASBackend):
return username.strip().lower()
def configure_user(self, user):
# cannot use "defaults" arg
profile, _ = CofProfile.objects.get_or_create(user=user)
profile.login_clipper = user.username
profile.save()
user.email = settings.CAS_EMAIL_FORMAT % profile.login_clipper
clipper = user.username
user.profile.login_clipper = clipper
user.profile.save()
user.email = settings.CAS_EMAIL_FORMAT % clipper
user.save()
return user

View file

@ -58,9 +58,8 @@ from kfet.statistic import ScaleMixin, last_stats_manifest, tot_ventes, WeekScal
@teamkfet_required
def login_genericteam(request):
# Check si besoin de déconnecter l'utilisateur de CAS
profile = getattr(request.user, 'profile', None)
cas_logout = None
if profile and profile.login_clipper:
if request.user.profile.login_clipper:
# Récupèration de la vue de déconnexion de CAS
# Ici, car request sera modifié après
next_page = request.META.get('HTTP_REFERER', None)
@ -2030,7 +2029,6 @@ def order_to_inventory(request, pk):
messages.success(request, "C'est tout bon !")
return redirect('kfet.order')
else:
print(formset.errors)
messages.error(request, "Corrigez les erreurs")
else:
formset = cls_formset(initial=initial)