summaryrefslogtreecommitdiffstats
path: root/server/api
diff options
context:
space:
mode:
authorJannik Schönartz2019-04-14 05:41:48 +0200
committerJannik Schönartz2019-04-14 05:41:48 +0200
commit9c7488e58053294bbc69fb12addd083d7c7ffbfa (patch)
treece682390e649cfd31f58c44968c3d21af22fe27f /server/api
parent[webapp/groups] fix tabslider incorrect length when tab name changes (diff)
downloadbas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.tar.gz
bas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.tar.xz
bas-9c7488e58053294bbc69fb12addd083d7c7ffbfa.zip
[server/registration] Set hostname as client name for clients with a fixed ip
Diffstat (limited to 'server/api')
-rw-r--r--server/api/registration.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index 4ab7cbc..ff0652b 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -178,9 +178,13 @@ noAuthRouter.postAsync('/clients', async (req, res) => {
if (ipSelection) {
// If not check if the client has a leased ipv4 address.
const ipCheck = await dhcp.instance.checkIp(dhcp.backend.credentials, network.ip)
+
// Build ipxe and return
- if (ipxe && ipCheck && !ipCheck.error) return res.send(buildSelectIpIpxeMenu(client, ipCheck, setIpError))
- else if (!ipxe && ipCheck && !ipCheck.error) return res.send({ client: client, ipList: ipCheck })
+ if (ipxe && ipCheck.leased && !ipCheck.error) return res.send(buildSelectIpIpxeMenu(client, ipCheck.nextIps, setIpError))
+ else if (!ipxe && ipCheck.leased && !ipCheck.error) return res.send({ client: client, ipList: ipCheck.nextIps })
+
+ // Set the hostname as clientname if it exists and is not a leased ip.
+ if (!ipCheck.leased && ipCheck.name) client.name = ipCheck.name
}
}
}