From 766023e59790d814d1db9068ddb36c33645b0fbf Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Fri, 2 Feb 2024 11:35:34 +0000 Subject: [PATCH] delay 2fa cookie for 2 and a half seconds (#68) --- src/MainForm.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MainForm.cs b/src/MainForm.cs index 25cd21a..ddd05e2 100644 --- a/src/MainForm.cs +++ b/src/MainForm.cs @@ -30,6 +30,7 @@ using Microsoft.Win32; using System.Drawing; using System.Text; using System.Web; +using System.Threading.Tasks; namespace MeshCentralRouter { @@ -1131,8 +1132,8 @@ namespace MeshCentralRouter cookieRefreshTimer.Enabled = true; // If we need to remember the 2nd factor, ask for a cookie now. - if (debug) { try { File.AppendAllText("debug.log", "Requesting 2FA cookie\r\n"); } catch (Exception) { } } - if (tokenRememberCheckBox.Checked) { meshcentral.sendCommand("{\"action\":\"twoFactorCookie\"}"); } + if (debug) { try { File.AppendAllText("debug.log", "Requesting 2FA cookie in 2 and half seconds time\r\n"); } catch (Exception) { } } + if (tokenRememberCheckBox.Checked) { Task.Delay(2500).ContinueWith((task) => { meshcentral.sendCommand("{\"action\":\"twoFactorCookie\"}"); }); } // Setup single instance pipe server if (authLoginUrl != null)