Skip to content

Commit

Permalink
change to enable backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lelemm committed Nov 14, 2024
1 parent 2233ba1 commit f0656b0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/account-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/app-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit f0656b0

Please sign in to comment.