diff --git a/src/dgsi/views.py b/src/dgsi/views.py index d446b3e..8c3b9f8 100644 --- a/src/dgsi/views.py +++ b/src/dgsi/views.py @@ -83,9 +83,12 @@ class GenerateWiFiPasswordView(LoginRequiredMixin, RedirectView): if user.kanidm is None: messages.error(self.request, _("Compte DGNum inexistant.")) - elif not user.kanidm.radius_secret: - messages.error(self.request, _("Mot de passe WiFi déjà existant.")) else: + # Give access to the wifi network when the user creates its first password + if not user.kanidm.radius_secret: + async_to_sync(klient.group_add_members)( + "radius_access", [user.username] + ) async_to_sync(klient.call_post)(f"/v1/person/{user.username}/_radius") return super().get(request, *args, **kwargs)