From 96e8434c96bb4b5740752194c8968adc267bd00f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 28 Jun 2019 22:30:14 +0200 Subject: [PATCH] Add acp info for user accounts which are connected with 3rdparty --- .../install/files/acp/templates/userAdd.tpl | 74 ++++++++++--------- .../files/lib/acp/form/UserEditForm.class.php | 2 +- .../files/lib/data/user/User.class.php | 14 ++++ .../files/lib/data/user/UserProfile.class.php | 6 +- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 6 files changed, 59 insertions(+), 39 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/userAdd.tpl b/wcfsetup/install/files/acp/templates/userAdd.tpl index cdf770f1f2..48e10f0ea9 100644 --- a/wcfsetup/install/files/acp/templates/userAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userAdd.tpl @@ -117,39 +117,47 @@ {/if} {if $action == 'add' || $__wcf->session->getPermission('admin.user.canEditPassword')} -
-

{lang}wcf.user.password{/lang}

- - -
-
- - {if $errorType.password|isset} - - {if $errorType.password == 'empty'} - {lang}wcf.global.form.error.empty{/lang} - {else} - {lang}wcf.user.password.error.{@$errorType.password}{/lang} - {/if} - - {/if} -
- - - -
-
- - {if $errorType.confirmPassword|isset} - - {lang}wcf.user.confirmPassword.error.{@$errorType.confirmPassword}{/lang} - - {/if} -
- - - {event name='passwordFields'} -
+ {if $action == 'edit' && !$user->authData|empty} +
+

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

+ +
{lang}wcf.user.3rdparty.connect.info{/lang}
+
+ {else} +
+

{lang}wcf.user.password{/lang}

+ + +
+
+ + {if $errorType.password|isset} + + {if $errorType.password == 'empty'} + {lang}wcf.global.form.error.empty{/lang} + {else} + {lang}wcf.user.password.error.{@$errorType.password}{/lang} + {/if} + + {/if} +
+ + + +
+
+ + {if $errorType.confirmPassword|isset} + + {lang}wcf.user.confirmPassword.error.{@$errorType.confirmPassword}{/lang} + + {/if} +
+ + + {event name='passwordFields'} +
+ {/if} {/if} {if $action == 'edit' && $__wcf->session->getPermission('admin.user.canBanUser') && $__wcf->user->userID != $userID} diff --git a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php index 5e3493d9dd..9d4e7121f7 100755 --- a/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserEditForm.class.php @@ -159,7 +159,7 @@ class UserEditForm extends UserAddForm { public function readFormParameters() { parent::readFormParameters(); - if (!WCF::getSession()->getPermission('admin.user.canEditPassword')) $this->password = $this->confirmPassword = ''; + if (!WCF::getSession()->getPermission('admin.user.canEditPassword') || !empty($this->user->authData)) $this->password = $this->confirmPassword = ''; if (!WCF::getSession()->getPermission('admin.user.canEditMailAddress')) $this->email = $this->confirmEmail = $this->user->email; if (!empty($_POST['banned'])) $this->banned = 1; diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 7ccc54a9a3..a0eee159c3 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -376,6 +376,20 @@ final class User extends DatabaseObject implements IRouteController, IUserConten return new User(null, $row); } + /** + * Returns 3rd party auth provider name. + * + * @return string + * @since 5.2 + */ + public function getAuthProvider() { + if (!$this->authData) { + return ''; + } + + return mb_substr($this->authData, 0, mb_strpos($this->authData, ':')); + } + /** * Returns true if this user is marked. * diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index c6730b4fd7..2af52f43d9 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -939,11 +939,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject { * @return string */ public function getAuthProvider() { - if (!$this->authData) { - return ''; - } - - return mb_substr($this->authData, 0, mb_strpos($this->authData, ':')); + return $this->getDecoratedObject()->getAuthProvider(); } /** diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 42c82e02ed..54df11156f 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4845,6 +4845,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email} + getAuthProvider()}{/lang} verknüpft.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index a0a0281b5f..e8e6141d94 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4841,6 +4841,7 @@ Open the link below to access the user profile: + getAuthProvider()}{/lang}.]]> -- 2.20.1