From aca0d5f418d10c796e5b0e041cba26beb5d9fc77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 28 Jun 2019 22:49:22 +0200 Subject: [PATCH] Add disconnect from 3rdparty provider option for administrators See #2951 --- wcfsetup/install/files/acp/templates/userAdd.tpl | 7 +++++++ .../files/lib/acp/form/UserEditForm.class.php | 16 ++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) 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); -- 2.20.1