mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-19 02:10:04 +08:00
fix: 🐛 init error with totp
This commit is contained in:
parent
5742d3068e
commit
ea7fbb154f
@ -14,13 +14,15 @@ import type { NextFunction, Request, Response } from "express";
|
||||
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||
|
||||
function checkAuth(req: Request, res: Response, next: NextFunction) {
|
||||
if (!sqlInit.isDbInitialized()) {
|
||||
res.redirect('setup');
|
||||
}
|
||||
|
||||
const currentTotpStatus = totp.isTotpEnabled();
|
||||
const currentSsoStatus = openID.isOpenIDEnabled();
|
||||
const lastAuthState = req.session.lastAuthState || { totpEnabled: false, ssoEnabled: false };
|
||||
|
||||
if (!sqlInit.isDbInitialized()) {
|
||||
res.redirect('setup');
|
||||
} else if (isElectron) {
|
||||
if (isElectron) {
|
||||
next();
|
||||
return;
|
||||
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import crypto from "crypto";
|
||||
import log from "../log.js";
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
"use strict";
|
||||
|
||||
import optionService from "../options.js";
|
||||
import crypto from "crypto";
|
||||
import sql from "../sql.js";
|
||||
|
@ -132,9 +132,9 @@ const defaultOptions: DefaultOption[] = [
|
||||
{ name: "promotedAttributesOpenInRibbon", value: "true", isSynced: true },
|
||||
{ name: "editedNotesOpenInRibbon", value: "true", isSynced: true },
|
||||
{ name: "mfaEnabled", value: "false", isSynced: false },
|
||||
{ name: 'mfaMethod', value: 'totp', isSynced: false },
|
||||
{ name: 'encryptedRecoveryCodes', value: 'false', isSynced: true },
|
||||
{ name: 'userSubjectIdentifierSaved', value: 'false', isSynced: true },
|
||||
{ name: "mfaMethod", value: "totp", isSynced: false },
|
||||
{ name: "encryptedRecoveryCodes", value: "false", isSynced: false },
|
||||
{ name: "userSubjectIdentifierSaved", value: "false", isSynced: false },
|
||||
|
||||
// Appearance
|
||||
{ name: "splitEditorOrientation", value: "horizontal", isSynced: true },
|
||||
|
Loading…
x
Reference in New Issue
Block a user