]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/authmethods.js
Began implementation of authpopout
[citadel.git] / webcit / static / authmethods.js
index 67018a7c2aaef8f59d639bc629f1289b371e5db2..1ea70c00de969628ba684e55edd76a3aceb96d83 100644 (file)
@@ -66,6 +66,23 @@ function ajax_try_username_and_password() {
        });
 }
 
+/*
+ * The user pressed a key while in the username or password box.
+ * Is it the enter/return key?  Submit the form.
+ */
+function username_and_password_onkeypress(e) {
+       if (window.event) {             /* IE */
+               keynum = e.keyCode
+       }
+       else if (e.which) {             /* real browsers */
+               keynum = e.which
+       }
+       if (keynum == 13) {             /* enter/return key */
+               ajax_try_username_and_password();
+       }
+}
+
+
 /*
  * tab handler for the login box
  */
@@ -74,3 +91,23 @@ function authtoggle(show_which_div) {
        $('authbox_openid').style.display = 'none';
        $(show_which_div).style.display = 'block';
 }
+
+
+/*
+ * Pop out a window for external auth methods
+ * (most of them don't handle inline auth very well)
+ */
+function do_auth_popout(popout_url) {
+       window.open(popout_url, "authpopout", "status=1,toolbar=0,width=600,height=400");
+}
+
+
+/*
+ * Attempt login with OpenID, called from modal dialog
+ */
+function ajax_try_openid() {
+       $('login_errmsg').innerHTML = "";
+       openid_url = encodeURI($('ajax_openid_form').elements["openid_url"].value);
+       do_auth_popout("openid_login?openid_url=" + openid_url);
+}
+