Wikinaut has submitted this change and it was merged.
Change subject: (bug 45323) preference tab "OpenID" adds a list of "trust"
records
......................................................................
(bug 45323) preference tab "OpenID" adds a list of "trust" records
= list of "consumer" domains and services for which the user
allowed to use their MediaWiki OpenID
This patch enables users - for the first time - to list their "consumer"
domains and services. Where they allow to use their MediaWiki OpenID.
The information is stored in the OpenID Server when one adds
the OpenID at the Consumer site.
Change-Id: Id2d1a0710f698d904e339ed194be6494937ceb5d
---
M CHANGES
M OpenID.hooks.php
M OpenID.i18n.php
M OpenID.php
M SpecialOpenIDServer.body.php
5 files changed, 74 insertions(+), 23 deletions(-)
Approvals:
Wikinaut: Verified; Looks good to me, approved
diff --git a/CHANGES b/CHANGES
index 16d2e5d..ad69a31 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
CHANGES
=======
+2.03 20130227 fix bug45323 preference tab "OpenID" shows list of "trust"
records
2.01 20130209 fix to allow identity selection bug44416
fix bug40068, bug40067 $wgOpenIDConsumerForce
changed default value $wgOpenIDShowProviderIcons = true;
diff --git a/OpenID.hooks.php b/OpenID.hooks.php
index 0305c57..3649e6a 100644
--- a/OpenID.hooks.php
+++ b/OpenID.hooks.php
@@ -142,7 +142,7 @@
return true;
}
- private static function getInfoTable( $user ) {
+ private static function getAssociatedOpenIDsTable( $user ) {
global $wgLang;
$openid_urls_registration =
SpecialOpenID::getUserOpenIDInformation( $user );
$delTitle = SpecialPage::getTitleFor( 'OpenIDConvert', 'Delete'
);
@@ -199,15 +199,46 @@
return $info;
}
+ private static function getTrustTable( $user ) {
+
+ $trusted_sites = SpecialOpenIDServer::GetUserTrustArray( $user
);
+ $rows = '';
+
+ foreach ( $trusted_sites as $key => $value ) {
+
+ if ( $key !== "" ) {
+
+ $rows .= Xml::tags( 'tr', array(),
+ Xml::tags( 'td',
+ array(),
+ Xml::element( 'a', array(
'href' => $key ), $key )
+ )
+ ) . "\n";
+
+ }
+ }
+
+ $trusted_sites_table = Xml::tags( 'table', array( 'class' =>
'wikitable' ),
+ Xml::tags( 'tr', array(),
+ Xml::element( 'th',
+ array(),
+ wfMessage(
'openid-trusted-sites-table-header' )->text() )
+ ) . "\n" .
+ $rows
+ );
+
+ return $trusted_sites_table;
+ }
+
public static function onGetPreferences( $user, &$preferences ) {
global $wgOpenIDShowUrlOnUserPage, $wgAllowRealName;
- global $wgAuth, $wgUser, $wgLang;
+ global $wgAuth, $wgUser, $wgLang, $wgOpenIDOnlyClient;
if ( $wgOpenIDShowUrlOnUserPage == 'user' ) {
$preferences['openid-hide'] =
array(
- 'type' => 'toggle',
'section' => 'openid',
+ 'type' => 'toggle',
'label-message' => 'openid-pref-hide',
);
}
@@ -223,8 +254,8 @@
$preferences['openid-update-on-login'] =
array(
- 'type' => 'multiselect',
'section' => 'openid',
+ 'type' => 'multiselect',
'label-message' =>
'openid-pref-update-userinfo-on-login',
'options' => $update,
'prefix' => 'openid-update-on-login-',
@@ -232,34 +263,50 @@
$preferences['openid-urls'] =
array(
+ 'section' => 'openid',
'type' => 'info',
'label-message' => 'openid-urls-desc',
- 'default' => self::getInfoTable( $user ),
+ 'default' => self::getAssociatedOpenIDsTable(
$user ),
'raw' => true,
- 'section' => 'openid',
);
+
+ if ( !$wgOpenIDOnlyClient ) {
+
+ $preferences['openid-trusted-sites'] =
+ array(
+ 'section' => 'openid',
+ 'type' => 'info',
+ 'label-message' =>
'openid-trusted-sites',
+ 'default' => self::getTrustTable( $user
),
+ 'raw' => true,
+ );
+
+ }
if ( $wgAuth->allowPasswordChange() ) {
- $resetlink = $wgUser->getSkin()->link(
SpecialPage::getTitleFor( 'PasswordReset' ),
- wfMsgHtml( 'passwordreset' ), array(),
- array( 'returnto' => SpecialPage::getTitleFor(
'Preferences' ) ) );
+ $resetlink = $wgUser->getSkin()->link(
+ SpecialPage::getTitleFor( 'PasswordReset' ),
+ wfMessage( 'passwordreset' )->text(),
+ array(),
+ array( 'returnto' => SpecialPage::getTitleFor(
'Preferences' ) )
+ );
if ( empty( $wgUser->mPassword ) && empty(
$wgUser->mNewpassword ) ) {
$preferences['password'] = array(
+ 'section' => 'personal/info',
'type' => 'info',
'raw' => true,
'default' => $resetlink,
'label-message' => 'yourpassword',
- 'section' => 'personal/info',
);
} else {
$preferences['resetpassword'] = array(
+ 'section' => 'personal/info',
'type' => 'info',
'raw' => true,
'default' => $resetlink,
'label-message' => null,
- 'section' => 'personal/info',
);
}
@@ -267,13 +314,12 @@
if ( $wgCookieExpiration > 0 ) {
unset( $preferences['rememberpassword'] );
$preferences['rememberpassword'] = array(
- 'type' => 'toggle',
- 'label' => wfMsgExt(
- 'tog-rememberpassword',
- array( 'parsemag' ),
- $wgLang->formatNum( ceil(
$wgCookieExpiration / ( 3600 * 24 ) ) )
- ),
'section' => 'personal/info',
+ 'type' => 'toggle',
+ 'label' => wfMessage(
+ 'tog-rememberpassword',
+ $wgLang->formatNum( ceil(
$wgCookieExpiration / ( 3600 * 24 ) ) )
+ )->escaped(),
);
}
diff --git a/OpenID.i18n.php b/OpenID.i18n.php
index d75f94b..9c0ca70 100644
--- a/OpenID.i18n.php
+++ b/OpenID.i18n.php
@@ -126,7 +126,9 @@
'openid-urls-registration' => 'Registration time',
'openid-urls-registration-date-time' => '$1', # only translate this
message to other languages if you have to change it
'openid-urls-delete' => 'Delete',
- 'openid-add-url' => 'Add a new OpenID',
+ 'openid-trusted-sites' => 'Sites you trust and where you have used your
OpenID for logging in:',
+ 'openid-trusted-sites-table-header' => 'Trusted sites',
+ 'openid-add-url' => 'Add a new OpenID to your account',
'openid-login-or-create-account' => 'Log in or create a new account',
'openid-provider-label-openid' => 'Enter your OpenID URL',
@@ -1426,7 +1428,9 @@
'openid-urls-action' => 'Aktion',
'openid-urls-registration' => 'Registrierungszeitpunkt',
'openid-urls-delete' => 'Löschen',
- 'openid-add-url' => 'Eine neue OpenID hinzufügen',
+ 'openid-add-url' => 'Eine neue OpenID deinem Benutzerkonto hinzufügen',
+ 'openid-trusted-sites' => 'Websites, denen du vertraust, und bei denen
du mit deiner OpenID bekannt bist:',
+ 'openid-trusted-sites-table-header' => 'Websites, denen du vertraust',
'openid-login-or-create-account' => 'Anmelden oder ein neues
Benutzerkonto erstellen',
'openid-provider-label-openid' => 'Gib deine OpenID-URL an',
'openid-provider-label-google' => 'Mit deinem Google-Benutzerkonto
anmelden',
diff --git a/OpenID.php b/OpenID.php
index 1d0f3de..e98c889 100644
--- a/OpenID.php
+++ b/OpenID.php
@@ -29,7 +29,7 @@
exit( 1 );
}
-define( 'MEDIAWIKI_OPENID_VERSION', '2.02 20130214' );
+define( 'MEDIAWIKI_OPENID_VERSION', '2.03 20130303' );
$path = dirname( __FILE__ );
set_include_path( implode( PATH_SEPARATOR, array( $path ) ) . PATH_SEPARATOR .
get_include_path() );
diff --git a/SpecialOpenIDServer.body.php b/SpecialOpenIDServer.body.php
index 62a1d06..1d776af 100644
--- a/SpecialOpenIDServer.body.php
+++ b/SpecialOpenIDServer.body.php
@@ -480,7 +480,7 @@
$this->SetUserTrustArray( $user, $trust_array );
}
- function GetUserTrustArray( $user ) {
+ static function GetUserTrustArray( $user ) {
$trust_array = array();
$trust_str = $user->getOption( 'openid_trust' );
if ( strlen( $trust_str ) > 0 ) {
@@ -492,7 +492,7 @@
$trust_array[$trust_root] = false;
} else {
$fields = array_map( 'trim', $fields );
- $fields = array_filter( $fields, array(
$this, 'ValidField' ) );
+ $fields = array_filter( $fields, array(
'SpecialOpenIDServer', 'ValidField' ) );
$trust_array[$trust_root] = $fields;
}
}
@@ -522,7 +522,7 @@
$user->setOption( 'openid_trust', $trust_str );
}
- function ValidField( $name ) {
+ static function ValidField( $name ) {
# FIXME: eventually add timezone
static $fields = array( 'nickname', 'email', 'fullname',
'language' );
return in_array( $name, $fields );
--
To view, visit https://gerrit.wikimedia.org/r/51278
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id2d1a0710f698d904e339ed194be6494937ceb5d
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Ryan Lane <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Wikinaut <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits