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$ */ /* $Id$ */
a.openid-link, a.user-link, #edit-openid-url { a.openid-link, #edit-openid-url {
background-image: url("login-bg.png"); background-image: url("login-bg.png");
background-position: 0% 50%; background-position: 0% 50%;
background-repeat: no-repeat; background-repeat: no-repeat;
......
// $Id$ // $Id$
Drupal.behaviors.openid = function (context) { 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. // This behavior attaches by ID, so is only valid once on a page.
if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) { if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) {
$("#edit-openid-url").addClass('openid-processed'); $("#edit-openid-url").addClass('openid-processed');
$("#edit-name-wrapper").hide(); $loginElements.hide();
$("#edit-pass-wrapper").hide(); // Use .css("display", "block") instead of .show() to be Konqueror friendly.
$("#edit-openid-url-wrapper").show(); $openidElements.css("display", "block");
$("a.openid-link").hide();
$("a.user-link").show();
} }
$("a.openid-link:not(.openid-processed)", context) $("a.openid-link:not(.openid-processed)", context)
.addClass('openid-processed') .addClass('openid-processed')
.click( function() { .click( function() {
$("#edit-pass-wrapper").hide(); $loginElements.hide();
$("#edit-name-wrapper").fadeOut('medium', function() { $openidElements.css("display", "block");
$("#edit-openid-url-wrapper").fadeIn('medium'); // Remove possible error message.
}); $("#edit-name, #edit-pass").removeClass("error");
$("a.openid-link").hide(); $("div.messages.error").hide();
$("a.user-link").show(); // Set focus on OpenID URL field.
$("#edit-openid-url")[0].focus();
return false; return false;
}); });
$("a.user-link:not(.openid-processed)", context) $("a.user-link:not(.openid-processed)", context)
.addClass('openid-processed') .addClass('openid-processed')
.click(function() { .click(function() {
$("#edit-openid-url-wrapper").hide(); $openidElements.hide();
$("#edit-pass-wrapper").show(); $loginElements.css("display", "block");
$("#edit-name-wrapper").show(); // Clear OpenID URL field and remove possible error message.
$("a.user-link").hide(); $("#edit-openid-url").val('').removeClass("error");
$("a.openid-link").show(); $("div.messages.error").css("display", "block");
// Set focus on username field.
$("#edit-name")[0].focus();
return false; return false;
}); });
}; };
...@@ -84,8 +84,8 @@ function openid_form_alter(&$form, $form_state, $form_id) { ...@@ -84,8 +84,8 @@ function openid_form_alter(&$form, $form_state, $form_id) {
$form['#validate'] = array('openid_login_validate'); $form['#validate'] = array('openid_login_validate');
} }
$form['openid_link'] = array('#value' => l(t('Log in using OpenID'), '#', array('attributes' => array('class' => 'openid-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')))); $form['user_link'] = array('#value' => l(t('Cancel OpenID login'), '#', array('attributes' => array('class' => 'user-link'))), '#weight' => 3);
$form['openid_url'] = array( $form['openid_url'] = array(
'#type' => 'textfield', '#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