mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-13 04:13:19 +08:00
feat: 🎸 fix open_id error
This commit is contained in:
parent
0871d16fbc
commit
b320553d18
@ -1,9 +1,9 @@
|
||||
import OpenIDError from "../errors/open_id_error.js";
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import type { NextFunction, Request, Response } from "express";
|
||||
import openIDEncryption from "./encryption/open_id_encryption.js";
|
||||
import sqlInit from "./sql_init.js";
|
||||
import options from "./options.js";
|
||||
import { Session, auth } from "express-openid-connect";
|
||||
import type { Session } from "express-openid-connect";
|
||||
import sql from "./sql.js";
|
||||
|
||||
function isOpenIDEnabled() {
|
||||
@ -27,7 +27,7 @@ function getUserEmail() {
|
||||
|
||||
function clearSavedUser() {
|
||||
sql.execute("DELETE FROM user_data");
|
||||
options.setOption("isUserSaved", false);
|
||||
options.setOption("userSubjectIdentifierSaved", false);
|
||||
return {
|
||||
success: true,
|
||||
message: "Account data removed."
|
||||
@ -42,7 +42,7 @@ function checkOpenIDRequirements() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (process.env.TOTP_ENABLED?.toLocaleLowerCase() === "true"){
|
||||
if (process.env.TOTP_ENABLED?.toLocaleLowerCase() === "true") {
|
||||
throw new OpenIDError("Cannot enable both OpenID and TOTP!");
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ function generateOAuthConfig() {
|
||||
|
||||
if (req.oidc.user === undefined) {
|
||||
console.log("user invalid!");
|
||||
}else {
|
||||
} else {
|
||||
openIDEncryption.saveUser(
|
||||
req.oidc.user.sub.toString(),
|
||||
req.oidc.user.name.toString(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user