Merge branch 'louislam:master' into logging

This commit is contained in:
Andreas Brett
2021-11-19 08:56:25 +01:00
committed by GitHub
6 changed files with 142 additions and 69 deletions

View File

@@ -121,6 +121,7 @@ module.exports.io = io;
const { sendNotificationList, sendHeartbeatList, sendImportantHeartbeatList, sendInfo } = require("./client");
const { statusPageSocketHandler } = require("./socket-handlers/status-page-socket-handler");
const databaseSocketHandler = require("./socket-handlers/database-socket-handler");
const TwoFA = require("./2fa");
app.use(express.json());
@@ -448,10 +449,7 @@ exports.entryPage = "dashboard";
socket.on("disable2FA", async (callback) => {
try {
checkLogin(socket);
await R.exec("UPDATE `user` SET twofa_status = 0 WHERE id = ? ", [
socket.userID,
]);
await TwoFA.disable2FA(socket.userID);
log_info("auth", `Disabled 2FA token for user ${data.username}. IP=${getClientIp(socket)}`);