Commit 72a59b0b authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#186658 by fajerstarter: OpenID login usability fixes and JS cleanup, also...

#186658 by fajerstarter: OpenID login usability fixes and JS cleanup, also makes OpenID login Konqueror compatible
parent 135f366c
/* $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;
......
// $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;
});
};
......@@ -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',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment