diff --git a/firefox_addon/lib/main.js b/firefox_addon/lib/main.js index 9f89cd4..41249cc 100644 --- a/firefox_addon/lib/main.js +++ b/firefox_addon/lib/main.js @@ -54,7 +54,7 @@ function debug(s) console.log(s); } -function on_sumbit() +function on_sumbit(e) { var form = this; var fields = form.getElementsByTagName("input"); @@ -130,14 +130,25 @@ function on_sumbit() r = this.responseText.split("\n"); debug("resp " + r); protocol = r[0].split("="); - if (protocol[1] != "1") + if ((protocol.length == 2 && protocol[1] != "1" && protocol[1] != "gpass-1") || protocol.length != 2) { ret = false; - notifications.notify({ - title: "gPasss", - text: "Protocol version not supported, please upgrade your addon", - data: "Protocol version not supported, please upgrade your addon", - }); + if (protocol.length == 2 && protocol[1].startsWith("gpass")) + { + notifications.notify({ + title: "gPasss", + text: "Protocol version not supported, please upgrade your addon", + data: "Protocol version not supported, please upgrade your addon", + }); + } + else + { + notifications.notify({ + title: "gPasss", + text: "Error : It seems that it's not a gPass server", + data: this.responseText, + }); + } } else { @@ -183,7 +194,11 @@ function on_sumbit() gPassRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); gPassRequest.send(keys); - if (!ret) return ret; + if (!ret) + { + e.preventDefault(); + return ret; + } } } }