1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2026-01-16 15:03:14 +00:00

2FA cookie improvements.

This commit is contained in:
Ylian Saint-Hilaire
2022-05-23 16:45:44 -07:00
parent cf172125ac
commit 1568a36a38
2 changed files with 6 additions and 2 deletions

View File

@@ -1076,6 +1076,7 @@ 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\"}"); }
// Setup single instance pipe server

View File

@@ -676,8 +676,11 @@ namespace MeshCentralRouter
{
if (jsonAction.ContainsKey("cookie"))
{
string cookie = (string)jsonAction["cookie"];
if (onTwoFactorCookie != null) { onTwoFactorCookie(cookie); }
if (jsonAction["cookie"] == null) return;
if (jsonAction["cookie"].GetType() != typeof(string)) return;
string cookie = null;
try { cookie = (string)jsonAction["cookie"]; } catch (Exception) { }
if ((cookie != null) && (onTwoFactorCookie != null)) { onTwoFactorCookie(cookie); }
}
break;
}