From: Joshua Rüsweg Date: Fri, 28 Jun 2019 20:49:22 +0000 (+0200) Subject: Add disconnect from 3rdparty provider option for administrators X-Git-Tag: 5.2.0_Alpha_2~44^2~1^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aca0d5f418d10c796e5b0e041cba26beb5d9fc77;p=GitHub%2FWoltLab%2FWCF.git Add disconnect from 3rdparty provider option for administrators See #2951 --- diff --git a/wcfsetup/install/files/acp/templates/userAdd.tpl b/wcfsetup/install/files/acp/templates/userAdd.tpl index 48e10f0ea9..7a06ba541e 100644 --- a/wcfsetup/install/files/acp/templates/userAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userAdd.tpl @@ -122,6 +122,13 @@

{lang}wcf.user.3rdparty{/lang}

{lang}wcf.user.3rdparty.connect.info{/lang}
+ +
+
+
+ +
+
{else}
diff --git a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php index 9d4e7121f7..c86d740788 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php @@ -127,6 +127,12 @@ class UserEditForm extends UserAddForm { */ public $deleteCoverPhoto = 0; + /** + * true to delete the current auth data + * @var boolean + */ + public $disconnect3rdParty = 0; + /** * @inheritDoc */ @@ -186,6 +192,8 @@ class UserEditForm extends UserAddForm { if (isset($_POST['disableCoverPhotoExpires'])) $this->disableCoverPhotoExpires = @strtotime(StringUtil::trim($_POST['disableCoverPhotoExpires'])); } } + + if (WCF::getSession()->getPermission('admin.user.canEditPassword') && isset($_POST['disconnect3rdParty'])) $this->disconnect3rdParty = 1; } /** @@ -319,6 +327,10 @@ class UserEditForm extends UserAddForm { $this->additionalFields = array_merge($this->additionalFields, $avatarData); + if ($this->disconnect3rdParty) { + $this->additionalFields['authData'] = ''; + } + // add default groups $defaultGroups = UserGroup::getAccessibleGroups([UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS]); $oldGroupIDs = $this->user->getGroupIDs(); @@ -410,8 +422,8 @@ class UserEditForm extends UserAddForm { // reset password $this->password = $this->confirmPassword = ''; - // reload user when deleting the cover photo - if ($this->deleteCoverPhoto) $this->user = new User($this->userID); + // reload user when deleting the cover photo or disconneting from 3rd party auth provider + if ($this->deleteCoverPhoto || $this->disconnect3rdParty) $this->user = new User($this->userID); // show success message WCF::getTPL()->assign('success', true);