Quellcode durchsuchen

Log useragent on login

ghorsington vor 4 Jahren
Ursprung
Commit
e6bb4b4ff8
2 geänderte Dateien mit 2 neuen und 1 gelöschten Zeilen
  1. 1 0
      web/src/routes/login/discord.ts
  2. 1 1
      web/src/routes/login/discord_callback.ts

+ 1 - 0
web/src/routes/login/discord.ts

@@ -6,6 +6,7 @@ import { rpcClient } from "src/utils/rpc";
 import { ENV } from "src/utils/environment";
 
 export const get = async (req: ExpressRequest, res: ExpressResponse): Promise<void> => {
+    eventLogger.info("Login attempt from %s; UA: %s", req.ip, req.get("user-agent"));
     res.redirect(DiscordAPI.getAuthUrl({
         client_id: ENV.BOT_CLIENT_ID,
         redirect_url: ENV.WEB_AUTH_URI,

+ 1 - 1
web/src/routes/login/discord_callback.ts

@@ -10,6 +10,6 @@ export const get = async (req: ExpressRequest, res: ExpressResponse): Promise<vo
     if (req.session) {
         req.session.authTokenCode = data.code;
     }
-    eventLogger.verbose("Discord auth callback: %s", req.ip);
+    eventLogger.verbose("Discord auth callback: %s; UA: %s", req.ip, req.get("user-agent"));
     res.redirect("/login/discord_auth");
 };