Florianschmidtwelzow has uploaded a new change for review.
https://gerrit.wikimedia.org/r/154280
Change subject: Improve Login page
......................................................................
Improve Login page
* Use mw-ui-checkboxes (follow MW Login
Ib585e32463765d7eb7d0be5dae54dc828ddd4ca9)
* Seperate GoogleLogin area and MW Login are with a "or" line to prevent
confusion (especially the second "keep logged in")
* Use ResourceLoader module to load style instead of OutputPage::addStyle
Change-Id: I62300f0d6ace52a03b28e51be642ae04da684f2e
---
M GoogleLogin.php
M i18n/en.json
M i18n/qqq.json
M includes/GoogleLogin.body.php
M includes/GoogleLogin.hooks.php
M includes/specials/SpecialGoogleLogin.php
A style/ext.GoogleLogin.css
D style/style.css
8 files changed, 61 insertions(+), 24 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GoogleLogin
refs/changes/80/154280/1
diff --git a/GoogleLogin.php b/GoogleLogin.php
index 79fdc98..56d4d46 100644
--- a/GoogleLogin.php
+++ b/GoogleLogin.php
@@ -63,6 +63,14 @@
$wgHooks['PersonalUrls'][] = 'GoogleLoginHooks::onPersonalUrls';
$wgHooks['SpecialPage_initList'][] =
'GoogleLoginHooks::onSpecialPage_initList';
$wgHooks['GetPreferences'][] = 'GoogleLoginHooks::onGetPreferences';
+ $wgHooks['BeforePageDisplay'][] =
'GoogleLoginHooks::onBeforePageDisplay';
+
+ // ResourceLoader modules
+ $wgResourceModules['ext.GoogleLogin.style'] = array(
+ 'styles' => 'style/ext.GoogleLogin.css',
+ 'localBasePath' => __DIR__,
+ 'remoteExtPath' => 'GoogleLogin'
+ );
// Configuration settings defaults
diff --git a/i18n/en.json b/i18n/en.json
index 54c7c5d..f5bb231 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -32,6 +32,7 @@
"googlelogin-information-body": "In the following table you find
information about your Google account and if it is linked to a wiki account or
not.",
"googlelogin-linkstatus": "Link status",
"googlelogin-linked": "linked",
+ "googlelogin-or": "or",
"googlelogin-unlinked": "not linked",
"googlelogin-link-other": "Your Google account is already linked to
another user. Please unlink the connection or contact an administrator, if you
have no other wiki account.",
"googlelogin-success-merge": "Congratulations! Your wiki account is now
linked to your Google account.",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index abd6469..72d1a7c 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -33,6 +33,7 @@
"googlelogin-information-body": "Information text above account
information table, that the following table contains information about the
Google and wiki account and the link status (linked, not linked).",
"googlelogin-linkstatus": "Title of value Link status in account
information table on Special:GoogleLogin (is wiki account linked to Google
account?).",
"googlelogin-linked": "Google and wiki account are linked. (Used in
account information table)",
+ "googlelogin-or": "'or' to show as seperator on login page (GoogleLogin
'or' MediaWiki Login)",
"googlelogin-unlinked": "Google and wiki account aren't linked. (Used
in account information table)",
"googlelogin-link-other": "The Google account is already linked to a
wiki user, but not to the actual logged in wiki user. To link the Google
account with the actual wiki account, the user must unlink the connection wit
the other wiki account, only one connection per Google account is allowed.",
"googlelogin-success-merge": "Successful message, that the wiki account
is now linked with the Google account.",
diff --git a/includes/GoogleLogin.body.php b/includes/GoogleLogin.body.php
index 55b3938..870cc2f 100644
--- a/includes/GoogleLogin.body.php
+++ b/includes/GoogleLogin.body.php
@@ -90,8 +90,8 @@
*/
public function getKeepLogin() {
$request = $this->getRequest();
- $status = $request->getSessionData(
'google-keep-loggedin' );
- $request->setSessionData( 'google-keep-loggedin', null
);
+ $status = $request->getSessionData(
'wpGoogleLoginRemember' );
+ $request->setSessionData( 'wpGoogleLoginRemember', null
);
return ( $status ? true : false );
}
@@ -129,7 +129,7 @@
* Helps to set the correct values for post login redirect,
e.g. keep login
*/
public function setLoginParameter( $request ) {
- if ( $request->getVal( 'google-keep-loggedin' ) === "1"
) {
+ if ( $request->getVal( 'wpGoogleLoginRemember' ) ===
"1" ) {
$this->setKeepLogin( true );
}
$returnTo = $request->getVal( 'returnto' );
@@ -157,7 +157,7 @@
*/
public function setKeepLogin( $status = false ) {
$request = $this->getRequest();
- $request->setSessionData( 'google-keep-loggedin',
$status );
+ $request->setSessionData( 'wpGoogleLoginRemember',
$status );
}
/**
diff --git a/includes/GoogleLogin.hooks.php b/includes/GoogleLogin.hooks.php
index 898f453..cdafbea 100644
--- a/includes/GoogleLogin.hooks.php
+++ b/includes/GoogleLogin.hooks.php
@@ -39,21 +39,23 @@
$keepLogin = '';
if ( $wgGLShowKeepLogin ) {
$keepLogin = Html::input(
- 'google-keep-loggedin',
+ 'wpGoogleLoginRemember',
'1',
- 'checkbox'
- ) .
- ' ' . wfMessage( 'userlogin-remembermypassword'
)->text();
+ 'checkbox',
+ array( 'id' => 'wpGoogleLoginRemember' )
+ ) . ' ';
}
$header .=
- Html::openelement( 'div', array( 'class' =>
'mw-ui-vform-field' ) ) .
- Html::openElement(
- 'label',
- array( 'class' =>
'mw-ui-checkbox-label' )
- ) .
+ Html::openElement( 'div', array( 'class' =>
'mw-ui-vform-field' ) ) .
+ Html::openElement( 'div', array( 'class' =>
'mw-ui-checkbox' ) ) .
$keepLogin .
- Html::closeElement( 'label' ) .
+ Html::element(
+ 'label',
+ array( 'for' => 'wpGoogleLoginRemember'
),
+ wfMessage(
'userlogin-remembermypassword' )->escaped()
+ ) .
+ Html::closeElement( 'div') .
Html::closeElement( 'div') .
Html::openElement( 'div', array( 'class' =>
'mw-ui-vform-field' ) ) .
Html::element( 'input', array(
@@ -64,7 +66,10 @@
'value' => wfMessage(
'googlelogin' )->text()
), ''
) .
- Html::closeElement( 'div' );
+ Html::closeElement( 'div' ) .
+ Html::openElement( 'fieldset', array( 'class'
=> 'loginSeperator' ) ) .
+ Html::element( 'legend', array(), wfMessage(
'googlelogin-or' )->escaped() ) .
+ Html::closeElement( 'fieldset' );
$tpl->set( 'header', $header );
}
@@ -145,4 +150,13 @@
return true;
}
+
+ /**
+ * Load our css module
+ * @param OutputPage $out OutputPage object
+ * @param Skin $skin Skin object that will be used to generate
the page
+ */
+ public static function onBeforePageDisplay( OutputPage &$out,
Skin &$skin ) {
+ $out->addModules( 'ext.GoogleLogin.style' );
+ }
}
diff --git a/includes/specials/SpecialGoogleLogin.php
b/includes/specials/SpecialGoogleLogin.php
index f18118f..a4e5271 100644
--- a/includes/specials/SpecialGoogleLogin.php
+++ b/includes/specials/SpecialGoogleLogin.php
@@ -22,7 +22,6 @@
$this->setHeaders();
$request = $this->getRequest();
$out = $this->getOutput();
- $out->addStyle( $wgScriptPath .
'/extensions/GoogleLogin/style/style.css' );
$db = new GoogleLoginDB;
$this->mGoogleLogin = $googleLogin = new GoogleLogin;
diff --git a/style/ext.GoogleLogin.css b/style/ext.GoogleLogin.css
new file mode 100644
index 0000000..3bfbdd3
--- /dev/null
+++ b/style/ext.GoogleLogin.css
@@ -0,0 +1,22 @@
+.googlelogin-summary td {
+ border: 1px solid grey;
+ padding: 5px;
+}
+.googlelogin-summary {
+ border-collapse:collapse;
+ width: 100%;
+}
+.loginSeperator {
+ border: none;
+ border-top: 1px solid #aaa;
+ display: block;
+ text-align: center;
+ padding: 0px;
+ margin: 0px;
+}
+
+.loginSeperator legend {
+ padding: 5px 10px;
+ padding-top: 0px;
+ padding-bottom: 0px;
+}
\ No newline at end of file
diff --git a/style/style.css b/style/style.css
deleted file mode 100644
index 9f3d293..0000000
--- a/style/style.css
+++ /dev/null
@@ -1,8 +0,0 @@
-.googlelogin-summary td {
- border: 1px solid grey;
- padding: 5px;
-}
-.googlelogin-summary {
- border-collapse:collapse;
- width: 100%;
-}
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/154280
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I62300f0d6ace52a03b28e51be642ae04da684f2e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GoogleLogin
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits