mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-15 22:02:27 +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 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 openIDEncryption from "./encryption/open_id_encryption.js";
|
||||||
import sqlInit from "./sql_init.js";
|
import sqlInit from "./sql_init.js";
|
||||||
import options from "./options.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";
|
import sql from "./sql.js";
|
||||||
|
|
||||||
function isOpenIDEnabled() {
|
function isOpenIDEnabled() {
|
||||||
@ -27,7 +27,7 @@ function getUserEmail() {
|
|||||||
|
|
||||||
function clearSavedUser() {
|
function clearSavedUser() {
|
||||||
sql.execute("DELETE FROM user_data");
|
sql.execute("DELETE FROM user_data");
|
||||||
options.setOption("isUserSaved", false);
|
options.setOption("userSubjectIdentifierSaved", false);
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
message: "Account data removed."
|
message: "Account data removed."
|
||||||
@ -42,7 +42,7 @@ function checkOpenIDRequirements() {
|
|||||||
return false;
|
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!");
|
throw new OpenIDError("Cannot enable both OpenID and TOTP!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ function generateOAuthConfig() {
|
|||||||
|
|
||||||
if (req.oidc.user === undefined) {
|
if (req.oidc.user === undefined) {
|
||||||
console.log("user invalid!");
|
console.log("user invalid!");
|
||||||
}else {
|
} else {
|
||||||
openIDEncryption.saveUser(
|
openIDEncryption.saveUser(
|
||||||
req.oidc.user.sub.toString(),
|
req.oidc.user.sub.toString(),
|
||||||
req.oidc.user.name.toString(),
|
req.oidc.user.name.toString(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user