diff --git a/src/account-db.js b/src/account-db.js index abd27666..e745779d 100644 --- a/src/account-db.js +++ b/src/account-db.js @@ -2,7 +2,7 @@ import { join } from 'node:path'; import openDatabase from './db.js'; import config from './load-config.js'; import * as bcrypt from 'bcrypt'; -import { bootstrapPassword } from './accounts/password.js'; +import { bootstrapPassword, loginWithPassword } from './accounts/password.js'; import { bootstrapOpenId } from './accounts/openid.js'; let _accountDb; @@ -100,7 +100,7 @@ export async function bootstrap(loginSettings) { } accountDb.mutate('COMMIT'); - return {}; + return passEnabled ? loginWithPassword(loginSettings.password) : {}; } catch (error) { accountDb.mutate('ROLLBACK'); throw error; diff --git a/src/app-account.js b/src/app-account.js index abf57740..0edec9e0 100644 --- a/src/app-account.js +++ b/src/app-account.js @@ -40,13 +40,13 @@ app.get('/needs-bootstrap', (req, res) => { }); app.post('/bootstrap', async (req, res) => { - let { error } = await bootstrap(req.body); + let boot = await bootstrap(req.body); - if (error) { - res.status(400).send({ status: 'error', reason: error }); + if (boot?.error) { + res.status(400).send({ status: 'error', reason: boot?.error }); return; } - res.send({ status: 'ok' }); + res.send({ status: 'ok', data: boot }); }); app.get('/login-methods', (req, res) => {