Commit 0d8bc2c5 authored by klafyvel's avatar klafyvel

Merge branch 'fix_divers_autoregister' into 'dev'

Fix réponses multiples, ne crash pas

See merge request federez/re2o!461
parents 5faf1346 47e67c3a
Pipeline #2268 passed with stage
in 3 minutes and 14 seconds
......@@ -307,7 +307,7 @@ class Switch(AclMixin, Machine):
It must the the management interface for that device"""
switch_iptype = OptionalTopologie.get_cached_value('switchs_ip_type')
if switch_iptype:
return self.interface_set.filter(machine_type__ip_type=switch_iptype).first()
return self.interface_set.filter(machine_type__ip_type=switch_iptype).first() or self.interface_set.first()
return self.interface_set.first()
@cached_property
......
......@@ -768,7 +768,7 @@ class User(RevMixin, FieldPermissionModelMixin, AbstractBaseUser,
def autoregister_machine(self, mac_address, nas_type):
""" Fonction appellée par freeradius. Enregistre la mac pour
une machine inconnue sur le compte de l'user"""
allowed, _message = Machine.can_create(self, self.id)
allowed, _message, _rights = Machine.can_create(self, self.id)
if not allowed:
return False, _("Maximum number of registered machines reached.")
if not nas_type:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment