#186658 by fajerstarter: OpenID login usability fixes and JS cleanup, also makes OpenID login Konqueror compatible

6.x
Gábor Hojtsy 2007-11-20 10:00:04 +00:00
parent 135f366c2b
commit 72a59b0b82
3 changed files with 23 additions and 20 deletions

View File

@ -1,6 +1,6 @@
/* $Id$ */
a.openid-link, a.user-link, #edit-openid-url {
a.openid-link, #edit-openid-url {
background-image: url("login-bg.png");
background-position: 0% 50%;
background-repeat: no-repeat;

View File

@ -1,35 +1,38 @@
// $Id$
Drupal.behaviors.openid = function (context) {
var $loginElements = $("#edit-name-wrapper, #edit-pass-wrapper, a.openid-link");
var $openidElements = $("#edit-openid-url-wrapper, a.user-link");
// This behavior attaches by ID, so is only valid once on a page.
if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) {
$("#edit-openid-url").addClass('openid-processed');
$("#edit-name-wrapper").hide();
$("#edit-pass-wrapper").hide();
$("#edit-openid-url-wrapper").show();
$("a.openid-link").hide();
$("a.user-link").show();
$loginElements.hide();
// Use .css("display", "block") instead of .show() to be Konqueror friendly.
$openidElements.css("display", "block");
}
$("a.openid-link:not(.openid-processed)", context)
.addClass('openid-processed')
.click( function() {
$("#edit-pass-wrapper").hide();
$("#edit-name-wrapper").fadeOut('medium', function() {
$("#edit-openid-url-wrapper").fadeIn('medium');
});
$("a.openid-link").hide();
$("a.user-link").show();
$loginElements.hide();
$openidElements.css("display", "block");
// Remove possible error message.
$("#edit-name, #edit-pass").removeClass("error");
$("div.messages.error").hide();
// Set focus on OpenID URL field.
$("#edit-openid-url")[0].focus();
return false;
});
$("a.user-link:not(.openid-processed)", context)
.addClass('openid-processed')
.click(function() {
$("#edit-openid-url-wrapper").hide();
$("#edit-pass-wrapper").show();
$("#edit-name-wrapper").show();
$("a.user-link").hide();
$("a.openid-link").show();
$openidElements.hide();
$loginElements.css("display", "block");
// Clear OpenID URL field and remove possible error message.
$("#edit-openid-url").val('').removeClass("error");
$("div.messages.error").css("display", "block");
// Set focus on username field.
$("#edit-name")[0].focus();
return false;
});
};

View File

@ -84,8 +84,8 @@ function openid_form_alter(&$form, $form_state, $form_id) {
$form['#validate'] = array('openid_login_validate');
}
$form['openid_link'] = array('#value' => l(t('Log in using OpenID'), '#', array('attributes' => array('class' => 'openid-link'))));
$form['user_link'] = array('#value' => l(t('Cancel OpenID login'), '#', array('attributes' => array('class' => 'user-link'))));
$form['openid_link'] = array('#value' => l(t('Log in using OpenID'), '#', array('attributes' => array('class' => 'openid-link'))), '#weight' => 3);
$form['user_link'] = array('#value' => l(t('Cancel OpenID login'), '#', array('attributes' => array('class' => 'user-link'))), '#weight' => 3);
$form['openid_url'] = array(
'#type' => 'textfield',