const data = await res.json(); if (data.success) window.location.href = data.redirect; else document.getElementById('errorMsg').innerText = data.error;

const res = await fetch('/api/login', method: 'POST', headers: 'Content-Type': 'application/json' , body: JSON.stringify( email, password, remember ) );

// Handle login app.post('/api/login', (req, res) => const email, password, remember = req.body;

// Login page app.get('/login', (req, res) => res.sendFile(__dirname + '/views/login.html'); );

; </script> </body> </html> Add a table child_devices and a form in the dashboard:

app.use(express.urlencoded( extended: true )); app.use(express.json()); app.use(session( secret: 'vtech-portal-secret-key', resave: false, saveUninitialized: false, cookie: maxAge: 1000 * 60 * 60 * 24 // 1 day ));