1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-21 20:38:22 +02:00

Store auth token to don't login everytime

This commit is contained in:
Yohann D'ANELLO
2020-10-29 15:40:30 +01:00
parent db30b481a3
commit 238333a175
2 changed files with 30 additions and 2 deletions

View File

@ -262,6 +262,9 @@ class TeamLeaveView(LoginRequiredMixin, TemplateView):
request.user.registration.team = None
request.user.registration.save()
get_sympa_client().unsubscribe(request.user.email, f"equipe-{team.trigram.lower()}", False)
Matrix.kick(f"#team-{team.trigram.lower()}:correspondances-maths.fr",
f"@{request.user.registration.matrix_username}:correspondances-maths.fr",
"Équipe quittée")
if team.students.count() + team.coachs.count() == 0:
team.delete()
return redirect(reverse_lazy("index"))