Wikinaut has uploaded a new change for review.
https://gerrit.wikimedia.org/r/81629
Change subject: Bug 46617: Allow account creation through OpenID when the wiki
disallows for anons
......................................................................
Bug 46617: Allow account creation through OpenID when the wiki disallows for
anons
Change-Id: Ieec0cbb349e6d94b621cff1711a4ee01c36df8ae
---
M OpenID.hooks.php
M OpenID.i18n.php
M OpenID.php
A SpecialOpenIDCreateAccountByMail.body.php
4 files changed, 83 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OpenID
refs/changes/29/81629/1
diff --git a/OpenID.hooks.php b/OpenID.hooks.php
index 7eca34b..5a46edd 100644
--- a/OpenID.hooks.php
+++ b/OpenID.hooks.php
@@ -32,7 +32,8 @@
# Special pages are added at global scope;
# remove server-related ones if client-only flag is set
- $addList = array( 'Login', 'Convert', 'Dashboard', 'Identifier'
);
+ $addList = array( 'Login', 'Convert', 'CreateAccountByMail',
'Dashboard' , 'Identifier' );
+
if ( $wgOpenIDConsumerAndAlsoProvider ) {
$addList[] = 'Server';
$addList[] = 'XRDS';
@@ -90,11 +91,13 @@
$sk = $wgUser->getSkin();
$returnto = $title->isSpecial( 'Userlogout' ) ? '' : (
'returnto=' . $title->getPrefixedURL() );
- $personal_urls['openidlogin'] = array(
- 'text' => wfMessage( 'openidlogin' )->text(),
- 'href' => $sk->makeSpecialUrl( 'OpenIDLogin',
$returnto ),
- 'active' => $title->isSpecial( 'OpenIDLogin' )
- );
+ if ( $wgUser->isAllowed( 'openid-login-with-openid' ) )
{
+ $personal_urls['openidlogin'] = array(
+ 'text' => wfMessage( 'openidlogin'
)->text(),
+ 'href' => $sk->makeSpecialUrl(
'OpenIDLogin', $returnto ),
+ 'active' => $title->isSpecial(
'OpenIDLogin' )
+ );
+ }
if ( $wgOpenIDLoginOnly ) {
# remove other login links
@@ -523,6 +526,22 @@
/**
* @return string
*/
+ private static function loginStyle() {
+ $openIDLogo = self::getOpenIDSmallLogoUrl();
+ return <<<EOS
+<style type='text/css'>
+li#pt-openidlogin {
+background: url($openIDLogo) top left no-repeat;
+padding-left: 20px;
+text-transform: none;
+}
+</style>
+EOS;
+ }
+
+ /**
+ * @return string
+ */
private static function providerStyle() {
global $wgExtensionAssetsPath;
@@ -535,22 +554,6 @@
}
return $ret . "</style>";
- }
-
- /**
- * @return string
- */
- private static function loginStyle() {
- $openIDLogo = self::getOpenIDSmallLogoUrl();
- return <<<EOS
-<style type='text/css'>
-li#pt-openidlogin {
-background: url($openIDLogo) top left no-repeat;
-padding-left: 20px;
-text-transform: none;
-}
-</style>
-EOS;
}
}
diff --git a/OpenID.i18n.php b/OpenID.i18n.php
index 435e0b3..4b1f120 100644
--- a/OpenID.i18n.php
+++ b/OpenID.i18n.php
@@ -44,6 +44,7 @@
The page has no other purpose.',
'openidxrds' => 'Yadis file',
'openidconvert' => 'OpenID converter',
+ 'openidcreateaccountbymail' => 'Create a user account by mail',
'openiderror' => 'Verification error',
'openiderrortext' => 'An error occurred during verification of the
OpenID URL.',
'openid-error-no-auth' => 'An unspecified authentication
response/request error occurred during the verification of the OpenID URL $1.',
@@ -227,6 +228,7 @@
[[w:Yadis|Yadis]] is a communications protocol for discovery of services such
as OpenID, OAuth, and XDI connected to a Yadis ID.',
'openidconvert' => 'Used as page title in Special:OpenIDConvert.',
+ 'openidcreateaccountbymail' => 'Used as page title for
Special:OpenIDCreateAccountByMail page (create a new user account by mail) on
Special:Pages.',
'openiderror' => 'Used as error page title.
This message is title for the following error messages:
diff --git a/OpenID.php b/OpenID.php
index 50407e1..2cbbddd 100644
--- a/OpenID.php
+++ b/OpenID.php
@@ -400,6 +400,7 @@
$wgAutoloadClasses['SpecialOpenIDServer'] = $dir .
'SpecialOpenIDServer.body.php';
$wgAutoloadClasses['SpecialOpenIDXRDS'] = $dir . 'SpecialOpenIDXRDS.body.php';
$wgAutoloadClasses['SpecialOpenIDDashboard'] = $dir .
'SpecialOpenIDDashboard.body.php';
+$wgAutoloadClasses['SpecialOpenIDCreateAccountByMail'] = $dir .
'SpecialOpenIDCreateAccountByMail.body.php';
# UI class
$wgAutoloadClasses['OpenIDProvider'] = $dir . 'OpenIDProvider.body.php';
@@ -430,6 +431,10 @@
# new user rights
$wgAvailableRights[] = 'openid-dashboard-access';
$wgAvailableRights[] = 'openid-dashboard-admin';
+$wgAvailableRights[] = 'openid-login-with-openid';
+
+# allow everyone to login with OpenID
+$wgGroupPermissions['*']['openid-login-with-openid'] = true;
# uncomment to allow users to read access the dashboard
# $wgGroupPermissions['user']['openid-dashboard-access'] = true;
diff --git a/SpecialOpenIDCreateAccountByMail.body.php
b/SpecialOpenIDCreateAccountByMail.body.php
new file mode 100644
index 0000000..c229a5d
--- /dev/null
+++ b/SpecialOpenIDCreateAccountByMail.body.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * SpecialOpenIDLogin.body.php -- Consumer side of OpenID site
+ * Copyright 2006,2007 Internet Brands (http://www.internetbrands.com/)
+ * Copyright 2007,2008 Evan Prodromou <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @file
+ * @author Evan Prodromou <[email protected]>
+ * @author Thomas Gries
+ * @ingroup Extensions
+ */
+
+if ( !defined( 'MEDIAWIKI' ) )
+ exit( 1 );
+
+class SpecialOpenIDCreateAccountByMail extends SpecialPage {
+
+ function __construct() {
+ parent::__construct( 'OpenIDCreateAccountByMail',
'createaccount' );
+ }
+
+ /**
+ * Entry point
+ *
+ * @param $par String or null
+ */
+ function execute( $par ) {
+ global $wgRequest, $wgUser;
+
+ $loginForm = new LoginForm();
+ $loginForm->execute( 'signup' );
+
+ return true;
+ }
+
+}
+
--
To view, visit https://gerrit.wikimedia.org/r/81629
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieec0cbb349e6d94b621cff1711a4ee01c36df8ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OpenID
Gerrit-Branch: master
Gerrit-Owner: Wikinaut <[email protected]>
Gerrit-Reviewer: Wikinaut <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits