8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-22 11:23:10 +00:00

Merge branch 'fix_divers_autoregister' into 'dev'

Fix réponses multiples, ne crash pas

See merge request federez/re2o!461
This commit is contained in:
klafyvel 2019-10-14 23:52:37 +02:00
commit 0d8bc2c578
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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: