jenkins-bot has submitted this change and it was merged.
Change subject: Update MoodBar for AuthManager
......................................................................
Update MoodBar for AuthManager
Bug: T110286
Change-Id: Iaea353286f2892c795d324deb1fd9fc4c754d226
---
M ApiMoodBarSetUserEmail.php
1 file changed, 18 insertions(+), 2 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/ApiMoodBarSetUserEmail.php b/ApiMoodBarSetUserEmail.php
index ea60165..3dafcb5 100644
--- a/ApiMoodBarSetUserEmail.php
+++ b/ApiMoodBarSetUserEmail.php
@@ -1,8 +1,10 @@
<?php
+use MediaWiki\Auth\AuthManager;
+
class ApiMoodBarSetUserEmail extends ApiBase {
public function execute() {
- global $wgAuth, $wgEnableEmail, $wgEmailAuthentication;
+ global $wgEnableEmail, $wgEmailAuthentication;
$user = $this->getUser();
if ( $user->isAnon() ) {
@@ -15,7 +17,7 @@
switch ( $params['mbaction']) {
case 'setemail':
- if ( !$wgAuth->allowPropChange( 'emailaddress'
) ) {
+ if ( !self::isEmailChangeAllowed() ) {
$error = $this->msg(
'cannotchangeemail' )->parse();
} else {
//only set email if user does not have
email on profile yet
@@ -63,6 +65,20 @@
}
/**
+ * Test whether email address change is supposed to be allowed
+ * @return boolean
+ */
+ private static function isEmailChangeAllowed() {
+ global $wgAuth, $wgDisableAuthManager;
+
+ if ( class_exists( AuthManager::class ) &&
!$wgDisableAuthManager ) {
+ return AuthManager::singleton()->allowsPropertyChange(
'emailaddress' );
+ } else {
+ return $wgAuth->allowPropChange( 'emailaddress' );
+ }
+ }
+
+ /**
* Temporary solution, will use Preference::trySetUserEmail in 1.19
*/
private static function trySetUserEmail( User $user, $newaddr ) {
--
To view, visit https://gerrit.wikimedia.org/r/290720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iaea353286f2892c795d324deb1fd9fc4c754d226
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MoodBar
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits