Commit 56f391d7 authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

FIx temporaires pour l'autodetect

parent 49f911cf
......@@ -284,11 +284,11 @@ def decide_vlan_and_register_macauth(switch_id, port_number, mac_address):
elif not room_user.first().has_access():
return (sw_name, 'Machine inconnue et adhérent non cotisant', VLAN_NOK)
else:
result, reason = user.autoregister_machine(mac_address)
result, reason = room_user.first().autoregister_machine(mac_address, ipv4.first())
if result:
return (sw_name, 'Access Ok, Capture de la mac...', VLAN_OK)
else:
return (sw_name, u'Erreur dans le register mac %s' % reason, VLAN_NOK)
return (sw_name, u'Erreur dans le register mac %s' % reason + unicode(mac_address), VLAN_NOK)
elif not interface.first().is_active:
return (sw_name, 'Machine non active / adherent non cotisant', VLAN_NOK)
else:
......
......@@ -474,14 +474,12 @@ class User(AbstractBaseUser):
machine_parent.clean()
domain = Domain()
domain.name = self.pseudo.replace('_','-').lower() + str(all_machines.count())
with transaction.atomic(), reversion.create_revision():
machine_parent.save()
interface_cible.machine = machine_parent
interface_cible.save()
domain.interface_parent = interface_cible
domain.clean()
domain.save()
reversion.set_comment("Autocapture radius")
machine_parent.save()
interface_cible.machine = machine_parent
interface_cible.save()
domain.interface_parent = interface_cible
domain.clean()
domain.save()
except Exception as e:
return False, e
return True, "Ok"
......
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