espid2sensor: Admin-Bootstrap via ADMIN_EMAIL/ADMIN_PASSWORD
Für extern verwaltete Deployments (Portainer, kein direkter Mongo-Zugriff) wird beim Start automatisch ein Admin-User angelegt, falls die user-Collection leer ist und ADMIN_EMAIL/ADMIN_PASSWORD gesetzt sind. Login-Seite zeigt einen Hinweis, solange noch kein User existiert. Version auf 1.5.0 angehoben.
This commit is contained in:
@@ -7,13 +7,15 @@ export function registerAuthRoutes(app) {
|
||||
const errText = 'Falsche Email oder falsches Passwort.'
|
||||
|
||||
|
||||
app.get('/login', (req, res) => {
|
||||
app.get('/login', async (req, res) => {
|
||||
const version = pkg.version
|
||||
const vdate = pkg.date
|
||||
res.render('login', {
|
||||
const noUsers = (await usersCollection.countDocuments()) === 0;
|
||||
res.render('login', {
|
||||
error: null,
|
||||
version: version,
|
||||
vdate: vdate
|
||||
vdate: vdate,
|
||||
noUsers: noUsers
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user