mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-20 02:37:21 +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;
|
const noAuthentication = config.General && config.General.noAuthentication === true;
|
||||||
|
|
||||||
function checkAuth(req: Request, res: Response, next: NextFunction) {
|
function checkAuth(req: Request, res: Response, next: NextFunction) {
|
||||||
|
if (!sqlInit.isDbInitialized()) {
|
||||||
|
res.redirect('setup');
|
||||||
|
}
|
||||||
|
|
||||||
const currentTotpStatus = totp.isTotpEnabled();
|
const currentTotpStatus = totp.isTotpEnabled();
|
||||||
const currentSsoStatus = openID.isOpenIDEnabled();
|
const currentSsoStatus = openID.isOpenIDEnabled();
|
||||||
const lastAuthState = req.session.lastAuthState || { totpEnabled: false, ssoEnabled: false };
|
const lastAuthState = req.session.lastAuthState || { totpEnabled: false, ssoEnabled: false };
|
||||||
|
|
||||||
if (!sqlInit.isDbInitialized()) {
|
if (isElectron) {
|
||||||
res.redirect('setup');
|
|
||||||
} else if (isElectron) {
|
|
||||||
next();
|
next();
|
||||||
return;
|
return;
|
||||||
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
|
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import log from "../log.js";
|
import log from "../log.js";
|
||||||
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
import optionService from "../options.js";
|
import optionService from "../options.js";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
import sql from "../sql.js";
|
import sql from "../sql.js";
|
||||||
|
@ -132,9 +132,9 @@ const defaultOptions: DefaultOption[] = [
|
|||||||
{ name: "promotedAttributesOpenInRibbon", value: "true", isSynced: true },
|
{ name: "promotedAttributesOpenInRibbon", value: "true", isSynced: true },
|
||||||
{ name: "editedNotesOpenInRibbon", value: "true", isSynced: true },
|
{ name: "editedNotesOpenInRibbon", value: "true", isSynced: true },
|
||||||
{ name: "mfaEnabled", value: "false", isSynced: false },
|
{ name: "mfaEnabled", value: "false", isSynced: false },
|
||||||
{ name: 'mfaMethod', value: 'totp', isSynced: false },
|
{ name: "mfaMethod", value: "totp", isSynced: false },
|
||||||
{ name: 'encryptedRecoveryCodes', value: 'false', isSynced: true },
|
{ name: "encryptedRecoveryCodes", value: "false", isSynced: false },
|
||||||
{ name: 'userSubjectIdentifierSaved', value: 'false', isSynced: true },
|
{ name: "userSubjectIdentifierSaved", value: "false", isSynced: false },
|
||||||
|
|
||||||
// Appearance
|
// Appearance
|
||||||
{ name: "splitEditorOrientation", value: "horizontal", isSynced: true },
|
{ name: "splitEditorOrientation", value: "horizontal", isSynced: true },
|
||||||
|
Loading…
x
Reference in New Issue
Block a user