Sha256: 98544d2934bbc77d3ffd76dc7095ece9a81b27b7d6c6a93f871c42f6dbf8ff1c

Contents?: true

Size: 1.83 KB

Versions: 7

Compression:

Stored size: 1.83 KB

Contents

<% if AeUsers.js_framework == "jquery" -%>
function chooseHavePassword() {
    val = jQuery('.auth_form input[name="login[have_password]"]:checked').val();
	var $password = jQuery('.auth_form input[name="login[password]"]');
	$password.val("");
	
	if (val == "true") {
	    $password.attr('disabled', '');
		$password.focus();
	} else {
	    $password.attr('disabled', 'disabled');
	}
}

function emailKeyPressListener(event) {
	if (event.keyCode == 9) {
	    jQuery('.auth_form input[name="login[have_password]"][value="true"]').attr('checked', 'checked');
	    chooseHavePassword();
	    return false;
	}
}

jQuery(document).ready(function () {
    <% if (params[:login] and params[:login][:password]) -%>
      jQuery('.auth_form input[name="login[have_password]"][value="false"]').attr('checked', 'checked');
    <% end -%>
	chooseHavePassword();
	jQuery('.auth_form input[name="login[have_password]"]').bind('change', chooseHavePassword);
	jQuery('.auth_form input[name="login[email]"]').bind('keydown', emailKeyPressListener);
});
<% else -%>
function chooseHavePassword() {
	val = $('login_have_password_true').checked;
	password = $('login_password');
	password.value = "";
	
	if (val) {
		password.disabled = false;
		password.focus();
	} else {
		password.disabled = true;
	}
}

function emailKeyPressListener(event) {
	if (event.keyCode == 9) {
		$('login_have_password_true').checked = true;
		chooseHavePassword();
		Event.stop(event);
	}
}

Event.observe(window, 'load', function () {
    <% if (params[:login] and params[:login][:password]) -%>
      $('login_have_password_true').checked = true;
    <% end -%>
    chooseHavePassword();
	$('login_have_password_true').observe('change', chooseHavePassword);
	$('login_have_password_false').observe('change', chooseHavePassword);
	$('login_email').observe('keydown', emailKeyPressListener);
});
<% end -%>

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ae_users_legacy-0.6.10 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.9 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.8 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.7 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.6 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.5 app/views/auth/auth_form.js.erb
ae_users_legacy-0.6.3 app/views/auth/auth_form.js.erb