summaryrefslogtreecommitdiffstats
path: root/server/api/registration.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/api/registration.js')
-rw-r--r--server/api/registration.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/api/registration.js b/server/api/registration.js
index 2ebf522..5c5437b 100644
--- a/server/api/registration.js
+++ b/server/api/registration.js
@@ -232,9 +232,14 @@ noAuthRouter.postAsync('/clients/:uuid', async (req, res) => {
const clientDb = await db.client.findOne({ where: { uuid: req.params.uuid } })
if (!clientDb) return res.status(404).send({ error: 'CLIENT_NOT_FOUND', message: 'There is no client matching the provided uuid.' })
if (client.name) clientDb.update({ name: client.name })
- else client.name = clientDb.name
client.id = clientDb.id
+ // If domain gets updated without a hostname, set the hostname as name.
+ for (let index in client.networks) {
+ const network = client.networks[index]
+ if (network.domain && !network.hostname) network.hostname = clientDb.name
+ }
+
if (client && client.system) {
// System data. Sometime just string with whitespaces only.
if (!/\S/.test(client.system.manufacturer)) client.system.manufacturer = 'unavailable'