diff options
Diffstat (limited to 'askbot/skins/default/media/jquery-openid')
31 files changed, 479 insertions, 0 deletions
diff --git a/askbot/skins/default/media/jquery-openid/images/aol.gif b/askbot/skins/default/media/jquery-openid/images/aol.gif Binary files differnew file mode 100755 index 00000000..24d1e152 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/aol.gif diff --git a/askbot/skins/default/media/jquery-openid/images/blogger-1.png b/askbot/skins/default/media/jquery-openid/images/blogger-1.png Binary files differnew file mode 100755 index 00000000..8b360ea5 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/blogger-1.png diff --git a/askbot/skins/default/media/jquery-openid/images/blogger.ico b/askbot/skins/default/media/jquery-openid/images/blogger.ico Binary files differnew file mode 100755 index 00000000..1b9730b0 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/blogger.ico diff --git a/askbot/skins/default/media/jquery-openid/images/claimid-0.png b/askbot/skins/default/media/jquery-openid/images/claimid-0.png Binary files differnew file mode 100755 index 00000000..4a0ea1b3 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/claimid-0.png diff --git a/askbot/skins/default/media/jquery-openid/images/claimid.ico b/askbot/skins/default/media/jquery-openid/images/claimid.ico Binary files differnew file mode 100755 index 00000000..2b80f491 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/claimid.ico diff --git a/askbot/skins/default/media/jquery-openid/images/facebook.gif b/askbot/skins/default/media/jquery-openid/images/facebook.gif Binary files differnew file mode 100755 index 00000000..c5586455 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/facebook.gif diff --git a/askbot/skins/default/media/jquery-openid/images/flickr.ico b/askbot/skins/default/media/jquery-openid/images/flickr.ico Binary files differnew file mode 100755 index 00000000..11f6e07f --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/flickr.ico diff --git a/askbot/skins/default/media/jquery-openid/images/flickr.png b/askbot/skins/default/media/jquery-openid/images/flickr.png Binary files differnew file mode 100755 index 00000000..142405a6 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/flickr.png diff --git a/askbot/skins/default/media/jquery-openid/images/google.gif b/askbot/skins/default/media/jquery-openid/images/google.gif Binary files differnew file mode 100755 index 00000000..65395365 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/google.gif diff --git a/askbot/skins/default/media/jquery-openid/images/identica.png b/askbot/skins/default/media/jquery-openid/images/identica.png Binary files differnew file mode 100644 index 00000000..2b607db1 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/identica.png diff --git a/askbot/skins/default/media/jquery-openid/images/linkedin.gif b/askbot/skins/default/media/jquery-openid/images/linkedin.gif Binary files differnew file mode 100644 index 00000000..36e049ac --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/linkedin.gif diff --git a/askbot/skins/default/media/jquery-openid/images/livejournal-1.png b/askbot/skins/default/media/jquery-openid/images/livejournal-1.png Binary files differnew file mode 100755 index 00000000..e6436081 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/livejournal-1.png diff --git a/askbot/skins/default/media/jquery-openid/images/livejournal.ico b/askbot/skins/default/media/jquery-openid/images/livejournal.ico Binary files differnew file mode 100755 index 00000000..f3d21ec5 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/livejournal.ico diff --git a/askbot/skins/default/media/jquery-openid/images/myopenid-2.png b/askbot/skins/default/media/jquery-openid/images/myopenid-2.png Binary files differnew file mode 100755 index 00000000..f64fb8e8 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/myopenid-2.png diff --git a/askbot/skins/default/media/jquery-openid/images/myopenid.ico b/askbot/skins/default/media/jquery-openid/images/myopenid.ico Binary files differnew file mode 100755 index 00000000..ceb06e6a --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/myopenid.ico diff --git a/askbot/skins/default/media/jquery-openid/images/openid-inputicon.gif b/askbot/skins/default/media/jquery-openid/images/openid-inputicon.gif Binary files differnew file mode 100755 index 00000000..cde836c8 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/openid-inputicon.gif diff --git a/askbot/skins/default/media/jquery-openid/images/openid.gif b/askbot/skins/default/media/jquery-openid/images/openid.gif Binary files differnew file mode 100755 index 00000000..19eb7c6f --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/openid.gif diff --git a/askbot/skins/default/media/jquery-openid/images/openidico.png b/askbot/skins/default/media/jquery-openid/images/openidico.png Binary files differnew file mode 100755 index 00000000..ab622669 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/openidico.png diff --git a/askbot/skins/default/media/jquery-openid/images/openidico16.png b/askbot/skins/default/media/jquery-openid/images/openidico16.png Binary files differnew file mode 100755 index 00000000..ad718ac5 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/openidico16.png diff --git a/askbot/skins/default/media/jquery-openid/images/technorati-1.png b/askbot/skins/default/media/jquery-openid/images/technorati-1.png Binary files differnew file mode 100755 index 00000000..f7195240 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/technorati-1.png diff --git a/askbot/skins/default/media/jquery-openid/images/technorati.ico b/askbot/skins/default/media/jquery-openid/images/technorati.ico Binary files differnew file mode 100755 index 00000000..fa1083c1 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/technorati.ico diff --git a/askbot/skins/default/media/jquery-openid/images/twitter.gif b/askbot/skins/default/media/jquery-openid/images/twitter.gif Binary files differnew file mode 100644 index 00000000..173cace1 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/twitter.gif diff --git a/askbot/skins/default/media/jquery-openid/images/verisign-2.png b/askbot/skins/default/media/jquery-openid/images/verisign-2.png Binary files differnew file mode 100755 index 00000000..c1467008 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/verisign-2.png diff --git a/askbot/skins/default/media/jquery-openid/images/verisign.ico b/askbot/skins/default/media/jquery-openid/images/verisign.ico Binary files differnew file mode 100755 index 00000000..3953af93 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/verisign.ico diff --git a/askbot/skins/default/media/jquery-openid/images/vidoop.ico b/askbot/skins/default/media/jquery-openid/images/vidoop.ico Binary files differnew file mode 100755 index 00000000..bbd9a0d5 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/vidoop.ico diff --git a/askbot/skins/default/media/jquery-openid/images/vidoop.png b/askbot/skins/default/media/jquery-openid/images/vidoop.png Binary files differnew file mode 100755 index 00000000..032c9e98 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/vidoop.png diff --git a/askbot/skins/default/media/jquery-openid/images/wordpress.ico b/askbot/skins/default/media/jquery-openid/images/wordpress.ico Binary files differnew file mode 100755 index 00000000..31b7d2c2 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/wordpress.ico diff --git a/askbot/skins/default/media/jquery-openid/images/wordpress.png b/askbot/skins/default/media/jquery-openid/images/wordpress.png Binary files differnew file mode 100755 index 00000000..ee29f0cf --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/wordpress.png diff --git a/askbot/skins/default/media/jquery-openid/images/yahoo.gif b/askbot/skins/default/media/jquery-openid/images/yahoo.gif Binary files differnew file mode 100755 index 00000000..614910a9 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/images/yahoo.gif diff --git a/askbot/skins/default/media/jquery-openid/jquery.openid.js b/askbot/skins/default/media/jquery-openid/jquery.openid.js new file mode 100644 index 00000000..249413b9 --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/jquery.openid.js @@ -0,0 +1,440 @@ +$.fn.authenticator = function() { + var signin_page = $(this); + var signin_form = $('#signin-form'); + var openid_login_token_input = $('input[name=openid_login_token]'); + var openid_login_token_input_fields = $('#openid-fs'); + var provider_name_input = $('input[name=login_provider_name]'); + var email_input_fields = $('#email-input-fs'); + var account_recovery_heading = $('#account-recovery-heading'); + var account_recovery_hint = $('#account-recovery-form>.hint'); + var account_recovery_link = $('#account-recovery-form>.hint>span.link'); + var account_recovery_text_span = $('#account-recovery-form>.hint>span.text'); + var password_input_fields = $('#password-fs'); + var existing_login_methods_div = $('#existing-login-methods'); + var openid_submit_button = $('input[name=openid_login_with_extra_token]'); + var existing_login_methods = {}; + + var account_recovery_question_text = account_recovery_heading.html(); + var account_recovery_prompt_text = account_recovery_text_span.html(); + + var setup_click_handler = function(elements, handler_function){ + elements.unbind('click').click(handler_function); + }; + + var setup_enter_key_handler = function(elements, handler_function){ + elements.each( + function(index, element){ + $(element).unbind('keypress').keypress( + function(e){ + if ((e.which && e.which == 13)||(e.keyCode && e.keyCode == 13)){ + if (handler_function){ + return handler_function(); + } + else { + element.click(); + return false; + } + } + } + ); + } + ); + }; + + var setup_event_handlers = function(elements, handler_function){ + setup_click_handler(elements, handler_function); + setup_enter_key_handler(elements); + }; + + var get_provider_name = function(row_el){ + var row = $(row_el); + var name_span = row.find('.ab-provider-name'); + return provider_name = $.trim(name_span.html()); + }; + + var read_existing_login_methods = function(){ + $('.ab-provider-row').each( + function(i, provider_row){ + var provider_name = get_provider_name(provider_row); + existing_login_methods[provider_name] = true; + } + ); + }; + + var setup_login_method_deleters = function(){ + $('.ab-provider-row').each( + function(i, provider_row){ + var provider_name = get_provider_name(provider_row); + var remove_button = $( + provider_row + ).find('button'); + remove_button.click( + function(){ + var message = interpolate(gettext('Are you sure you want to remove your %s login?'), [provider_name]); + if (confirm(message)){ + $.ajax({ + type: 'POST', + url: authUrl + 'delete_login_method/',//url!!! + data: {provider_name: provider_name}, + success: function(data, text_status, xhr){ + $(provider_row).remove(); + delete existing_login_methods[provider_name]; + provider_count -=1; + if (provider_count < 0){ + provider_count === 0; + } + if (provider_count === 0){ + $('#ab-existing-login-methods').remove(); + $('#ab-show-login-methods').remove(); + $('h1').html( + gettext("Please add one or more login methods.") + ); + $('#login-intro').html( + gettext("You don\'t have a method to log in right now, please add one or more by clicking any of the icons below.") + ); + existing_login_methods = null; + } + } + }); + } + } + ); + } + ); + } + + var submit_login_with_password = function(){ + var username = $('#id_username'); + var password = $('#id_password'); + + if (username.val().length < 1){ + username.focus(); + return false; + } + if (password.val().length < 1){ + password.focus(); + return false; + } + return true; + }; + + var submit_change_password = function(){ + var newpass = $('#id_new_password'); + var newpass_retyped = $('#id_new_password_retyped'); + if (newpass.val().length < 1){ + newpass.focus(); + return false + } + if (newpass_retyped.val().length < 1){ + newpass_retyped.focus(); + return false; + } + if (newpass.val() !== newpass_retyped.val()){ + newpass_retyped.after( + '<span class="error">' + + gettext('passwords do not match') + + '</span>' + ); + newpass.val('').focus(); + newpass_retyped.val(''); + return false; + } + return true; + }; + + //validator, may be extended to check url for openid + var submit_with_extra_openid_token = function() { + if (openid_login_token_input.val().length < 1) { + openid_login_token_input.focus(); + return false; + } + return true; + }; + + var insert_login_list_enabler = function(){ + var enabler = $('#login-list-enabler'); + if (enabler.is('p#login-list-enabler')){ + enabler.show(); + } + else { + enabler = $( + '<p id="login-list-enabler"><a href="#">' + + gettext('Show/change current login methods') + + '</a></p>'); + setup_event_handlers( + enabler, + function(){ + if (askbot['settings']['signin_always_show_local_login'] === false){ + password_input_fields.hide(); + } + openid_login_token_input_fields.hide(); + enabler.hide(); + existing_login_methods_div.show(); + } + ); + existing_login_methods_div.after(enabler); + } + }; + + var reset_password_input_fields = function(){ + if (userIsAuthenticated){ + $('#id_new_password').val(''); + $('#id_new_password_retyped').val(''); + } + else { + $('#id_username').val(''); + $('#id_password').val(''); + } + }; + + var reset_form = function(){ + openid_login_token_input_fields.hide(); + if (askbot['settings']['signin_always_show_local_login'] === false){ + password_input_fields.hide(); + } + reset_password_input_fields(); + if (userIsAuthenticated === false){ + email_input_fields.hide(); + account_recovery_heading.hide(); + account_recovery_link.show(); + account_recovery_hint.show(); + $('#account-recovery-form>p.hint').css('margin-top','10px'); + account_recovery_text_span.html(account_recovery_question_text).show(); + } + else { + if (existing_login_methods !== null){ + existing_login_methods_div.hide(); + insert_login_list_enabler(); + } + } + }; + + var reset_form_and_errors = function(){ + reset_form(); + $('.error').remove(); + } + + var set_provider_name = function(element){ + var provider_name = element.attr('name'); + provider_name_input.val(provider_name); + }; + + var show_openid_input_fields = function(provider_name){ + reset_form_and_errors(); + var token_name = extra_token_name[provider_name] + if (userIsAuthenticated){ + $('#openid-heading').html( + interpolate(gettext('Please enter your %s, then proceed'), [token_name]) + ); + var button_text = gettext('Connect your %(provider_name)s account to %(site)s'); + var data = { + provider_name: provider_name, + site: siteName + } + button_text = interpolate(button_text, data, true); + openid_submit_button.val(button_text); + } + else { + $('#openid-heading>span').html(token_name); + } + openid_login_token_input_fields.show(); + openid_login_token_input.focus(); + }; + + var start_simple_login = function() { + //$('#openid_form .providers td').removeClass('highlight'); + //$li.addClass('highlight'); + set_provider_name($(this)); + signin_form.submit(); + return true; + }; + + var start_login_with_extra_openid_token = function() { + show_openid_input_fields($(this).attr('name')); + set_provider_name($(this)); + + setup_enter_key_handler( + openid_login_token_input, + function(){ + openid_submit_button.click(); + return false; + } + ); + + setup_event_handlers( + openid_submit_button, + function(){ + signin_form.unbind( + 'submit' + ).submit( + submit_with_extra_openid_token + ); + } + ); + return false; + }; + + var start_facebook_login = function(){ + set_provider_name($(this)); + if (typeof FB != 'undefined'){ + FB.getLoginStatus(function(response){ + if (response.authResponse){ + signin_form.submit(); + } + else { + if (FB.getAuthResponse()){ + signin_form.submit(); + } + FB.login(); + } + }); + } + return false; + }; + + var start_password_login_or_change = function(){ + //called upon clicking on one of the password login buttons + reset_form_and_errors(); + set_provider_name($(this)); + var provider_name = $(this).attr('name'); + return setup_password_login_or_change(provider_name); + }; + + var init_always_visible_password_login = function(){ + reset_form(); + //will break wordpress and ldap + provider_name_input.val('local'); + setup_password_login_or_change('local'); + }; + + var setup_password_login_or_change = function(provider_name){ + var token_name = extra_token_name[provider_name] + var password_action_input = $('input[name=password_action]'); + if (userIsAuthenticated === true){ + var password_button = $('input[name=change_password]'); + var submit_action = submit_change_password; + if (provider_name === 'local'){ + var provider_cleaned_name = siteName; + } + else { + var provider_cleaned_name = provider_name; + } + if (existing_login_methods && existing_login_methods[provider_name]){ + var password_heading_text = interpolate(gettext('Change your %s password'), [provider_cleaned_name]) + var password_button_text = gettext('Change password') + } + else { + var password_heading_text = interpolate(gettext('Create a password for %s'), [provider_cleaned_name]) + var password_button_text = gettext('Create password') + } + $('#password-heading').html( + password_heading_text + ) + password_button.val(password_button_text); + password_action_input.val('change_password'); + var focus_input = $('#id_new_password'); + var submittable_input = $('#id_new_password_retyped'); + } + else{ + $('#password-heading>span').html(token_name); + var password_button = $('input[name=login_with_password]'); + var submit_action = submit_login_with_password; + var create_pw_link = $('a.create-password-account') + if (create_pw_link.length > 0){ + create_pw_link.html(gettext('Create a password-protected account')); + var url = create_pw_link.attr('href'); + if (url.indexOf('?') !== -1){ + url = url.replace(/\?.*$/,'?login_provider=' + provider_name); + } + else{ + url += '?login_provider=' + provider_name; + } + create_pw_link.attr('href', url); + } + password_action_input.val('login'); + var focus_input = $('#id_username'); + var submittable_input = $('#id_password'); + } + password_input_fields.show(); + focus_input.focus(); + + var submit_password_login = function(){ + signin_form.unbind('submit').submit(submit_action); + }; + + setup_enter_key_handler( + submittable_input, + function() { + password_button.click(); + return false; + } + ); + setup_event_handlers(password_button, submit_password_login); + return false; + }; + + var start_account_recovery = function(){ + reset_form_and_errors(); + account_recovery_hint.hide(); + account_recovery_heading.css('margin-bottom', '0px'); + account_recovery_heading.html(account_recovery_prompt_text).show(); + email_input_fields.show(); + $('#id_email').focus(); + }; + + var clear_password_fields = function(){ + $('#id_password').val(''); + $('#id_new_password').val(''); + $('#id_new_password_retyped').val(''); + }; + + var setup_default_handlers = function(){ + setup_event_handlers( + signin_page.find('input.openid-direct'), + start_simple_login + ); + + setup_event_handlers( + signin_page.find('input.openid-username'), + start_login_with_extra_openid_token + ); + + setup_event_handlers( + signin_page.find('input.openid-generic'), + start_login_with_extra_openid_token + ); + + setup_event_handlers( + signin_page.find('input.facebook'), + start_facebook_login + ); + + setup_event_handlers( + signin_page.find('input.oauth'), + start_simple_login + ); + + setup_event_handlers( + signin_page.find('input.password'), + start_password_login_or_change + ); + setup_event_handlers( + signin_page.find('input.wordpress_site'), + start_password_login_or_change + ); + + setup_event_handlers(account_recovery_link, start_account_recovery); + + if (userIsAuthenticated){ + read_existing_login_methods(); + setup_login_method_deleters(); + } + }; + + setup_default_handlers(); + if (askbot['settings']['signin_always_show_local_login'] === true){ + init_always_visible_password_login(); + } + clear_password_fields(); + return this; +}; diff --git a/askbot/skins/default/media/jquery-openid/openid.css b/askbot/skins/default/media/jquery-openid/openid.css new file mode 100644 index 00000000..9a1db85f --- /dev/null +++ b/askbot/skins/default/media/jquery-openid/openid.css @@ -0,0 +1,39 @@ +div#login-icons {padding: 0;} +ul.login-icons {width: 450px; margin:0;padding:0;text-align:left; list-style-type:none; display:block;} +ul.login-icons li {display:inline;} +ul.large input {height: 40px; width: 90px;border:1px solid #ccc;margin:0 5px 5px 0;} +.openid-signin h1 {padding-bottom: 10px;} +.openid-signin h2#account-recovery-heading {margin-bottom:2px;} +#account-recovery-form p.hint a {color:#1b79bd; text-decoration: none;} +#account-recovery-form p.hint a:hover {text-decoration: underline;} +.openid-signin fieldset { border-style:none;margin:0;padding:0;} +.openid-signin p {margin:0;padding:0}; +.openid-signin p.hint {color: #555;} +.openid-signin #password-fs label {width:100px;margin-top:5px;text-align:left;} +.openid-signin #password-fs .hint {margin-bottom:5px} +#password-fs a {padding-left:5px;} +/*#signin-form #account-recovery-form input {cursor:pointer;} +#signin-form #account-recovery-form input.text {cursor:default;}*/ + +table.login { text-align: right;} + +.openid-signin .submit-b { + cursor: pointer; /*letter-spacing:1px;*/ + margin: 0 0 2px 0; + vertical-align: middle; +} + +.openid-signin .highlight { -moz-border-radius:4px; -webkit-border-radius:4px; background-color: #FD6} + +ul.providers { + display: block; +} + +.openid-signin th { + color: #555; + font-weight: normal; +} + +.openid-signin .ab-provider-name { + font-weight: bold; +} |