X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fstatic%2Fauthmethods.js;h=a80543fdbbbedcff21bee5c02313ef7e80c8ad6a;hb=47970d6c1468d22fed15baccce00174b5af114e7;hp=85e9626dbdc4e534219c4aed9bb8b37e3a3159db;hpb=ad997b56ffb5979af4c7a951590e8e0648e28d5b;p=citadel.git diff --git a/webcit/static/authmethods.js b/webcit/static/authmethods.js index 85e9626db..a80543fdb 100644 --- a/webcit/static/authmethods.js +++ b/webcit/static/authmethods.js @@ -60,6 +60,8 @@ function authtoggle(show_which_div) { $('authbox_openid').style.display = 'none'; $('authbox_google').style.display = 'none'; $('authbox_yahoo').style.display = 'none'; + $('authbox_aol').style.display = 'none'; + $('authbox_success').style.display = 'none'; $(show_which_div).style.display = 'block'; } @@ -83,6 +85,7 @@ function do_auth_popout(popout_url) { function ajax_try_username_and_password() { $('login_errmsg').innerHTML = ""; + authtoggle('authbox_success'); $('ajax_username_password_form').request({ onSuccess: function(ctdlresult) { if (ctdlresult.responseText.substr(0,1) == '2') { @@ -90,6 +93,7 @@ function ajax_try_username_and_password() { } else { $('login_errmsg').innerHTML = ctdlresult.responseText.substr(4) ; + authtoggle('authbox_userpass'); } } }); @@ -124,6 +128,7 @@ function ajax_try_newuser() { $('ajax_newuser_form').request({ onSuccess: function(ctdlresult) { if (ctdlresult.responseText.substr(0,1) == '2') { + authtoggle('authbox_success'); window.location = 'pop'; } else { @@ -199,7 +204,7 @@ function ajax_try_google() { /****************** GOOGLE ***********************/ /* - * Attempt login with Google, called from modal dialog + * Attempt login with Yahoo, called from modal dialog */ function ajax_try_yahoo() { $('login_errmsg').innerHTML = ""; @@ -208,3 +213,34 @@ function ajax_try_yahoo() { } +/****************** 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; +} + +