From: MatmaRex Date: Sat, 24 Aug 2013 20:37:58 +0000 (+0200) Subject: Special:UserLogin UI improvements when user is logged in X-Git-Tag: 1.31.0-rc.0~18594 X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=23fb8551fef74e4450931a3c8f796512c82b38cc;p=lhc%2Fweb%2Fwiklou.git Special:UserLogin UI improvements when user is logged in * Show a warning about being already logged in above login form * Show a button pointing to signup form with suitable explanation Also changed some internal template stuff (s/createAnother/loggedin/). Bug: 53306 Change-Id: I1672ee09330c231110c4db310a645d1382cc0b59 --- diff --git a/includes/specials/SpecialUserlogin.php b/includes/specials/SpecialUserlogin.php index 7a93ade09a..2b60ca25b2 100644 --- a/includes/specials/SpecialUserlogin.php +++ b/includes/specials/SpecialUserlogin.php @@ -1167,12 +1167,8 @@ class LoginForm extends SpecialPage { $template->set( 'remember', $user->getOption( 'rememberpassword' ) || $this->mRemember ); $template->set( 'cansecurelogin', ( $wgSecureLogin === true ) ); $template->set( 'stickhttps', (int)$this->mStickHTTPS ); - - if ( $this->mType === 'signup' && $user->isLoggedIn() ) { - $template->set( 'createAnother', true ); - } else { - $template->set( 'createAnother', false ); - } + $template->set( 'loggedin', $user->isLoggedIn() ); + $template->set( 'loggedinuser', $user->getName() ); if ( $this->mType == 'signup' ) { if ( !self::getCreateaccountToken() ) { @@ -1231,9 +1227,7 @@ class LoginForm extends SpecialPage { * @return bool */ private function showCreateOrLoginLink( &$user ) { - if ( $user->isLoggedIn() ) { - return false; - } elseif ( $this->mType == 'signup' ) { + if ( $this->mType == 'signup' ) { return true; } elseif ( $user->isAllowed( 'createaccount' ) ) { return true; diff --git a/includes/templates/Usercreate.php b/includes/templates/Usercreate.php index 3d848cf5e1..50dfaecb47 100644 --- a/includes/templates/Usercreate.php +++ b/includes/templates/Usercreate.php @@ -58,7 +58,7 @@ class UsercreateTemplate extends BaseTemplate {

msg( $this->data['createAnother'] ? + $this->msg( $this->data['loggedin'] ? 'createacct-another-join' : 'createacct-join' ); ?>

@@ -89,7 +89,7 @@ class UsercreateTemplate extends BaseTemplate { 'tabindex' => '1', 'size' => '20', 'required', - 'placeholder' => $this->getMsg( $this->data['createAnother'] ? + 'placeholder' => $this->getMsg( $this->data['loggedin'] ? 'createacct-another-username-ph' : 'userlogin-yourname-ph' )->text(), ) ); ?> @@ -162,7 +162,7 @@ class UsercreateTemplate extends BaseTemplate { 'id' => 'wpEmail', 'tabindex' => '6', 'size' => '20', - 'placeholder' => $this->getMsg( $this->data['createAnother'] ? + 'placeholder' => $this->getMsg( $this->data['loggedin'] ? 'createacct-another-email-ph' : 'createacct-email-ph' )->text() ) + ( $this->data['emailrequired'] ? array() : array( 'required' => '' ) ) ); ?> @@ -175,7 +175,7 @@ class UsercreateTemplate extends BaseTemplate { tabindex="7" value="text( 'realname' ); ?>" size='20' />
- msgWiki( $this->data['createAnother'] ? 'createacct-another-realname-tip' : 'prefs-help-realname' ); ?> + msgWiki( $this->data['loggedin'] ? 'createacct-another-realname-tip' : 'prefs-help-realname' ); ?>
getMsg( $this->data['createAnother'] ? + $this->getMsg( $this->data['loggedin'] ? 'createacct-another-submit' : 'createacct-submit' ), 'submit', array( diff --git a/includes/templates/Userlogin.php b/includes/templates/Userlogin.php index 39091ef5f5..202ec55ed8 100644 --- a/includes/templates/Userlogin.php +++ b/includes/templates/Userlogin.php @@ -39,6 +39,11 @@ class UserloginTemplate extends BaseTemplate { ?>
+ data['loggedin'] ) { ?> +
+ getMsg( 'userlogin-loggedin' )->params( $this->data['loggedinuser'] )->parse(); ?> +
+
html( 'header' ); /* extensions such as ConfirmEdit add form HTML here */ ?>
@@ -164,9 +169,15 @@ class UserloginTemplate extends BaseTemplate { getMsg( 'userlogin-helplink' )->parse(); ?>
haveData( 'createOrLoginHref' ) ) { ?> -
- -
+ data['loggedin'] ) { ?> +
+ +
+ +
+ +
+ haveData( 'uselang' ) ) { ?> haveData( 'token' ) ) { ?> diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 3dedbb92ab..faaccd2fe8 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1134,6 +1134,9 @@ Do not forget to change your [[Special:Preferences|{{SITENAME}} preferences]].', 'userlogin-resetpassword-link' => 'Reset your password', 'helplogin-url' => 'Help:Logging in', 'userlogin-helplink' => '[[{{MediaWiki:helplogin-url}}|Help with logging in]]', +'userlogin-loggedin' => 'You are already logged in as {{GENDER:$1|$1}}. +Use the form below to log in as another user.', +'userlogin-createanother' => 'Create another account', 'createacct-join' => 'Enter your information below.', 'createacct-another-join' => "Enter the new account's information below.", 'createacct-emailrequired' => 'Email address', diff --git a/languages/messages/MessagesQqq.php b/languages/messages/MessagesQqq.php index 72fe747e89..0ffbcee165 100644 --- a/languages/messages/MessagesQqq.php +++ b/languages/messages/MessagesQqq.php @@ -1353,6 +1353,11 @@ See example: [[Special:UserLogin]] See also: * {{msg-mw|Helplogin-url}}', +'userlogin-loggedin' => 'Used instead of the form on [[Special:UserLogin]] when the current user is already logged in. + +Parameters: +* $1 - user name (used for display and for gender support)', +'userlogin-createanother' => 'Button on [[Special:UserLogin]] shown when the current user is already logged in.', 'createacct-join' => 'Subheading of vertical-layout create account form encouraging user to join the wiki. See example: [{{canonicalurl:Special:UserLogin|type=signup}} Special:UserLogin?type=signup]', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 01976f4a66..ca3a4f554b 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -485,6 +485,8 @@ $wgMessageStructure = array( 'userlogin-resetpassword-link', 'helplogin-url', 'userlogin-helplink', + 'userlogin-loggedin', + 'userlogin-createanother', 'createacct-join', 'createacct-another-join', 'createacct-emailrequired', diff --git a/resources/mediawiki.special/mediawiki.special.userLogin.css b/resources/mediawiki.special/mediawiki.special.userLogin.css index 312f8118b6..24c8d771ad 100644 --- a/resources/mediawiki.special/mediawiki.special.userLogin.css +++ b/resources/mediawiki.special/mediawiki.special.userLogin.css @@ -14,16 +14,19 @@ #mw-createaccount-cta { width: 20em; height: 10em; - text-align: center; /* @embed */ background: url(images/glyph-people-large.png) no-repeat 50%; margin: 0 auto; } -#mw-createaccount-cta h3 { +#mw-createaccount-cta h3, +#mw-createaccount-another h3 { font-size: 0.9em; font-weight: normal; text-align: center; +} + +#mw-createaccount-cta h3 { padding-top: 4em; }