]> jfr.im git - irc/quakenet/qwebirc.git/commitdiff
Fix several login bugs, add bouncer auth mode.
authorChris Porter <redacted>
Mon, 22 Jun 2009 02:17:30 +0000 (03:17 +0100)
committerChris Porter <redacted>
Mon, 22 Jun 2009 02:17:30 +0000 (03:17 +0100)
js/auth.js
js/irc/ircclient.js
js/ui/panes/connect.js
qwebirc/engines/ajaxengine.py
qwebirc/ircclient.py

index 8244b7e01e15b0441120b4d66b8c1eb0c6ae4fa3..d0e1be406043c7ac9328544b5f6b89008e449199 100644 (file)
@@ -5,7 +5,7 @@ qwebirc.auth.loggedin = function() {
 }
 
 qwebirc.auth.enabled = function() {
-  return true;
+  return false;
 }
 
 qwebirc.auth.quakeNetAuth = function() {
@@ -13,5 +13,9 @@ qwebirc.auth.quakeNetAuth = function() {
 }
 
 qwebirc.auth.passAuth = function() {
+  return true;
+}
+
+qwebirc.auth.bouncerAuth = function() {
   return false;
 }
index a4d193ec26b740c15adae4405fb603216a9298cd..b8cee6f3b27e893c9d00f457400711faf7b943ed 100644 (file)
@@ -24,6 +24,7 @@ qwebirc.irc.IRCClient = new Class({
     this.activeTimers = {};
     
     this.loginRegex = new RegExp(this.ui.options.loginRegex);
+    this.tracker = new qwebirc.irc.IRCTracker(this);
   },
   newLine: function(window, type, data) {
     if(!data)
index cd1c61cb3036b73284b08ee61e5bc1807e18a1a3..9161bfe3ea63b5491099543a8ae64746bee8614d 100644 (file)
@@ -61,7 +61,7 @@ qwebirc.ui.ConfirmBox = function(parentElement, callback, initialNickname, initi
   
   text.appendChild(document.createTextNode(" click 'Connect'."));
   text.appendChild(new Element("br"));
-  if(qwebirc.auth.enabled() && !qwebirc.auth.loggedin())
+  if(qwebirc.auth.enabled() && qwebirc.auth.quakeNetAuth() && !qwebirc.auth.loggedin())
     text.appendChild(document.createTextNode("If you'd like to connect using your Q auth click 'Log in'."));
 
   var tr = new Element("tr");
@@ -79,7 +79,7 @@ qwebirc.ui.ConfirmBox = function(parentElement, callback, initialNickname, initi
     callback({"nickname": initialNickname, "autojoin": initialChannels});
   });
   
-  if(qwebirc.auth.enabled() && !qwebirc.auth.loggedin()) {
+  if(qwebirc.auth.enabled() && qwebirc.auth.quakeNetAuth() && !qwebirc.auth.loggedin()) {
     var auth = new Element("input", {"type": "submit", "value": "Log in"});
     td.appendChild(auth);
     auth.addEvent("click", qwebirc.ui.AuthLogin);
@@ -152,20 +152,30 @@ qwebirc.ui.LoginBox = function(parentElement, callback, initialNickname, initial
 
   var nick = new Element("input");
   createRow("Nickname:", nick);
+  
+  var chanStyle = null;
+  if(qwebirc.auth.enabled() && qwebirc.auth.bouncerAuth())
+    chanStyle = {display: "none"};
+  
   var chan = new Element("input");
-  createRow("Channels:", chan);
+  createRow("Channels:", chan, chanStyle);
 
-  if(qwebirc.auth.enabled() && qwebirc.auth.passAuth()) {
-    var authRow = createRow("Auth to services:");
-    var checkBox = qwebirc.util.createInput("checkbox", authRow, "connect_auth_to_services", false);
+  if(qwebirc.auth.enabled()) {
+    if(qwebirc.auth.passAuth()) {
+      var authRow = createRow("Auth to services:");
+      var authCheckBox = qwebirc.util.createInput("checkbox", authRow, "connect_auth_to_services", false);
     
-    var usernameBox = new Element("input");
-    var usernameRow = createRow("Username:", usernameBox, {display: "none"})[0];
+      var usernameBox = new Element("input");
+      var usernameRow = createRow("Username:", usernameBox, {display: "none"})[0];
     
-    var passwordBox = new Element("input");
-    var passwordRow = createRow("Password:", passwordBox, {display: "none"})[0];
+      var passwordRow = createRow("Password:", null, {display: "none"});
+      var passwordBox = qwebirc.util.createInput("password", passwordRow[1], "connect_auth_password");
 
-    checkBox.addEvent("click", function(e) { qwebirc.ui.authShowHide(checkBox, authRow, usernameBox, usernameRow, passwordRow) });
+      authCheckBox.addEvent("click", function(e) { qwebirc.ui.authShowHide(authCheckBox, authRow, usernameBox, usernameRow, passwordRow[0]) });
+    } else if(qwebirc.auth.bouncerAuth()) {
+      var passwordRow = createRow("Password:");
+      var passwordBox = qwebirc.util.createInput("password", passwordRow, "connect_auth_password");
+    }
   }
   
   var connbutton = new Element("input", {"type": "submit"});
@@ -191,15 +201,34 @@ qwebirc.ui.LoginBox = function(parentElement, callback, initialNickname, initial
       return;
     }
 
-    parentElement.removeChild(outerbox);
-    
     var data = {"nickname": nickname, "autojoin": chans};
-    if($defined(usernameBox) && usernameBox.value && passwordBox.value)
-      data["serverPassword"] = usernameBox.value + " " + passwordBox.value;
+    if(qwebirc.auth.passAuth() && authCheckBox.checked) {
+        if(!usernameBox.value || !passwordBox.value) {
+          alert("You must supply your username and password in auth mode.");
+          if(!usernameBox.value) {
+            usernameBox.focus();
+          } else {
+            passwordBox.focus();
+          }
+          return;
+        }
+        
+        data["serverPassword"] = usernameBox.value + " " + passwordBox.value;
+    } else if(qwebirc.auth.bouncerAuth()) {
+      if(!passwordBox.value) {
+        alert("You must supply a password.");
+        passwordBox.focus();
+        return;
+      }
       
+      data["serverPassword"] = passwordBox.value;
+    }
+    
+    parentElement.removeChild(outerbox);
+    
     callback(data);
   }.bind(this));
-
+    
   nick.set("value", initialNickname);
   chan.set("value", initialChannels);
 
index 3750175b188cf8acb7b0856e6eb107765fd9914e..a7acb464e6ee8bec3b9a8b1c2ce180d7dd3930bb 100644 (file)
@@ -190,7 +190,7 @@ class AJAXEngine(resource.Resource):
       raise AJAXException, "Nickname not supplied."
     nick = ircclient.irc_decode(nick[0])
 
-    password = request.args.get("pass")
+    password = request.args.get("password")
     if password is not None:
       password = ircclient.irc_decode(password[0])
       
index 7f3cecd30b2ba5813eab9eaea082408e997e2334..f34398628609d57f5bdc23fc115f905ec6d20712 100644 (file)
@@ -71,7 +71,7 @@ class QWebIRCClient(basic.LineReceiver):
     
     self.lastError = None
     f = self.factory.ircinit
-    nick, ident, ip, realname, hostname, pass_ = f["nick"], f["ident"], f["ip"], f["realname"], f["hostname"], f.get("pass")
+    nick, ident, ip, realname, hostname, pass_ = f["nick"], f["ident"], f["ip"], f["realname"], f["hostname"], f.get("password")
     self.__nickname = nick
     self.__perform = f.get("perform")