diff --git a/src/ui/common.tis b/src/ui/common.tis index 320b4bf84..6ecfb4342 100644 --- a/src/ui/common.tis +++ b/src/ui/common.tis @@ -262,6 +262,15 @@ function msgbox(type, title, content, link="", callback=null, height=180, width= else msgbox("connecting", "Connecting...", "Logging in..."); } }; + } else if (type.indexOf("input-2fa") >= 0) { + callback = function (res) { + if (!res) { + view.close(); + return; + } + handler.send2fa(res.code); + msgbox("connecting", "Connecting...", "Logging in..."); + }; } else if (type == "session-login" || type == "session-re-login") { callback = function (res) { if (!res) { diff --git a/src/ui/msgbox.tis b/src/ui/msgbox.tis index d54b22c8e..391a5e7ff 100644 --- a/src/ui/msgbox.tis +++ b/src/ui/msgbox.tis @@ -41,7 +41,7 @@ class MsgboxComponent: Reactor.Component { } function getIcon(color) { - if (this.type == "input-password" || this.type == "session-login" || this.type == "session-login-password") { + if (this.type == "input-password" || this.type == "session-login" || this.type == "session-login-password" || this.type == "input-2fa") { return ; } if (this.type == "connecting") { @@ -50,7 +50,7 @@ class MsgboxComponent: Reactor.Component { if (this.type == "success") { return ; } - if (this.type.indexOf("error") >= 0 || this.type == "re-input-password" || this.type == "session-re-login" || this.type == "session-login-re-password") { + if (this.type.indexOf("error") >= 0 || this.type == "re-input-password" || this.type == "input-2fa" || this.type == "session-re-login" || this.type == "session-login-re-password") { return ; } return null; @@ -65,6 +65,13 @@ class MsgboxComponent: Reactor.Component { ; } + function get2faContent() { + return
+
{translate('enter-2fa-title')}
+
+
; + } + function getInputUserPasswordContent() { return
{translate("OS Username")}
@@ -90,6 +97,8 @@ class MsgboxComponent: Reactor.Component { function getContent() { if (this.type == "input-password") { return this.getInputPasswordContent(); + } else if (this.type == "input-2fa") { + return this.get2faContent(); } else if (this.type == "session-login") { return this.getInputUserPasswordContent(); } else if (this.type == "session-login-password") { @@ -105,7 +114,7 @@ class MsgboxComponent: Reactor.Component { } function getColor() { - if (this.type == "input-password" || this.type == "custom-os-password" || this.type == "session-login" || this.type == "session-login-password") { + if (this.type == "input-password" || this.type == "input-2fa" || this.type == "custom-os-password" || this.type == "session-login" || this.type == "session-login-password") { return "#AD448E"; } if (this.type == "success") { @@ -282,6 +291,12 @@ class MsgboxComponent: Reactor.Component { return; } } + if (this.type == "input-2fa") { + values.code = (values.code || "").trim(); + if (!values.code) { + return; + } + } if (this.type == "session-login") { values.osusername = (values.osusername || "").trim(); values.ospassword = (values.ospassword || "").trim(); diff --git a/src/ui/remote.rs b/src/ui/remote.rs index 1a74d6fb8..edd58ef61 100644 --- a/src/ui/remote.rs +++ b/src/ui/remote.rs @@ -417,6 +417,7 @@ impl sciter::EventHandler for SciterSession { fn is_port_forward(); fn is_rdp(); fn login(String, String, String, bool); + fn send2fa(String); fn new_rdp(); fn send_mouse(i32, i32, i32, bool, bool, bool, bool); fn enter(String);