Now we can log in with AOL too
[citadel.git] / webcit / static / authmethods.js
index fca4cf2664538741c0c17a17e4b0442d904b0191..ef800dd4ea668604975fcbea93f8e8878a128054 100644 (file)
@@ -58,6 +58,9 @@ function authtoggle(show_which_div) {
        $('authbox_userpass').style.display = 'none';
        $('authbox_newuser').style.display = 'none';
        $('authbox_openid').style.display = 'none';
+       $('authbox_google').style.display = 'none';
+       $('authbox_yahoo').style.display = 'none';
+       $('authbox_aol').style.display = 'none';
        $(show_which_div).style.display = 'block';
 }
 
@@ -138,10 +141,10 @@ function ajax_try_newuser() {
  */
 function newuser_onkeypress(e) {
        if (window.event) {             /* IE */
-               keynum = e.keyCode
+               keynum = e.keyCode;
        }
        else if (e.which) {             /* real browsers */
-               keynum = e.which
+               keynum = e.which;
        }
        if (keynum == 13) {             /* enter/return key */
                ajax_try_newuser();
@@ -163,4 +166,77 @@ function ajax_try_openid() {
 }
 
 
+/*
+ * The user pressed a key while in the openid login box.
+ * Is it the enter/return key?  Submit the form.
+ */
+function openid_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_openid();
+               return false;
+       }
+       return true;
+}
+
+
+/****************** GOOGLE ***********************/
+
+/*
+ * Attempt login with Google, called from modal dialog
+ */
+function ajax_try_google() {
+       $('login_errmsg').innerHTML = "";
+       openid_url = encodeURI("https://www.google.com/accounts/o8/id");
+       do_auth_popout("openid_login?openid_url=" + openid_url);
+}
+
+
+/****************** GOOGLE ***********************/
+
+/*
+ * Attempt login with Yahoo, called from modal dialog
+ */
+function ajax_try_yahoo() {
+       $('login_errmsg').innerHTML = "";
+       openid_url = encodeURI("http://yahoo.com");
+       do_auth_popout("openid_login?openid_url=" + openid_url);
+}
+
+
+/****************** AOL ***********************/
+
+/*
+ * Attempt login with AOL, called from modal dialog
+ */
+function ajax_try_aol() {
+       $('login_errmsg').innerHTML = "";
+       openid_url = encodeURI($('ajax_aol_form').elements["aol_screenname"].value);
+       do_auth_popout("openid_login?openid_url=http://openid.aol.com/" + openid_url);
+}
+
+
+/*
+ * The user pressed a key while in the AOL login box.
+ * Is it the enter/return key?  Submit the form.
+ */
+function aol_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_aol();
+               return false;
+       }
+       return true;
+}
+