Add acp info for user accounts which are connected with 3rdparty
authorJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 28 Jun 2019 20:30:14 +0000 (22:30 +0200)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 28 Jun 2019 20:39:10 +0000 (22:39 +0200)
wcfsetup/install/files/acp/templates/userAdd.tpl
wcfsetup/install/files/lib/acp/form/UserEditForm.class.php
wcfsetup/install/files/lib/data/user/User.class.php
wcfsetup/install/files/lib/data/user/UserProfile.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index cdf770f1f23c114287cb4f7d7d051357dc3c1bab..48e10f0ea997ab752a4b7f1282c5625accfe07e4 100644 (file)
                        {/if}
                        
                        {if $action == 'add' || $__wcf->session->getPermission('admin.user.canEditPassword')}
-                               <section class="section">
-                                       <h2 class="sectionTitle">{lang}wcf.user.password{/lang}</h2>
-                                       
-                                       <dl{if $errorType.password|isset} class="formError"{/if}>
-                                               <dt><label for="password">{lang}wcf.user.password{/lang}</label></dt>
-                                               <dd>
-                                                       <input type="password" id="password" name="password" value="{$password}" class="medium" autocomplete="off">
-                                                       {if $errorType.password|isset}
-                                                               <small class="innerError">
-                                                                       {if $errorType.password == 'empty'}
-                                                                               {lang}wcf.global.form.error.empty{/lang}
-                                                                       {else}
-                                                                               {lang}wcf.user.password.error.{@$errorType.password}{/lang}
-                                                                       {/if}
-                                                               </small>
-                                                       {/if}
-                                               </dd>
-                                       </dl>
-                                       
-                                       <dl{if $errorType.confirmPassword|isset} class="formError"{/if}>
-                                               <dt><label for="confirmPassword">{lang}wcf.user.confirmPassword{/lang}</label></dt>
-                                               <dd>
-                                                       <input type="password" id="confirmPassword" name="confirmPassword" value="{$confirmPassword}" class="medium" autocomplete="off">
-                                                       {if $errorType.confirmPassword|isset}
-                                                               <small class="innerError">
-                                                                       {lang}wcf.user.confirmPassword.error.{@$errorType.confirmPassword}{/lang}
-                                                               </small>
-                                                       {/if}
-                                               </dd>
-                                       </dl>
-                                       
-                                       {event name='passwordFields'}
-                               </section>
+                               {if $action == 'edit' && !$user->authData|empty}
+                                       <section class="section">
+                                               <h2 class="sectionTitle">{lang}wcf.user.3rdparty{/lang}</h2>
+                                               
+                                               <div class="info">{lang}wcf.user.3rdparty.connect.info{/lang}</div>
+                                       </section>
+                               {else}
+                                       <section class="section">
+                                               <h2 class="sectionTitle">{lang}wcf.user.password{/lang}</h2>
+                                               
+                                               <dl{if $errorType.password|isset} class="formError"{/if}>
+                                                       <dt><label for="password">{lang}wcf.user.password{/lang}</label></dt>
+                                                       <dd>
+                                                               <input type="password" id="password" name="password" value="{$password}" class="medium" autocomplete="off">
+                                                               {if $errorType.password|isset}
+                                                                       <small class="innerError">
+                                                                               {if $errorType.password == 'empty'}
+                                                                                       {lang}wcf.global.form.error.empty{/lang}
+                                                                               {else}
+                                                                                       {lang}wcf.user.password.error.{@$errorType.password}{/lang}
+                                                                               {/if}
+                                                                       </small>
+                                                               {/if}
+                                                       </dd>
+                                               </dl>
+                                               
+                                               <dl{if $errorType.confirmPassword|isset} class="formError"{/if}>
+                                                       <dt><label for="confirmPassword">{lang}wcf.user.confirmPassword{/lang}</label></dt>
+                                                       <dd>
+                                                               <input type="password" id="confirmPassword" name="confirmPassword" value="{$confirmPassword}" class="medium" autocomplete="off">
+                                                               {if $errorType.confirmPassword|isset}
+                                                                       <small class="innerError">
+                                                                               {lang}wcf.user.confirmPassword.error.{@$errorType.confirmPassword}{/lang}
+                                                                       </small>
+                                                               {/if}
+                                                       </dd>
+                                               </dl>
+                                               
+                                               {event name='passwordFields'}
+                                       </section>
+                               {/if}
                        {/if}
                        
                        {if $action == 'edit' && $__wcf->session->getPermission('admin.user.canBanUser') && $__wcf->user->userID != $userID}
index 5e3493d9dd716eae2523299a13415385f244c474..9d4e7121f716df0f97c3ae9715be513163b732b3 100755 (executable)
@@ -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;
index 7ccc54a9a3c47bb709d55dc159fd1f8d6ab7ffea..a0eee159c3c06f9d5f4b913b2c245149fa152966 100644 (file)
@@ -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.
         * 
index c6730b4fd7c8abe1c4c8cf45d725b41867518bc7..2af52f43d99c18182a1e09fe8b32254421b1c1d8 100644 (file)
@@ -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();
        }
        
        /**
index 42c82e02eda90ef7d2c175ccd979b7752478b053..54df11156fb4da67aaca5e3afc6c344c1dabaf73 100644 (file)
@@ -4845,6 +4845,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email}
                <item name="wcf.user.3rdparty.google.connect.error.inuse"><![CDATA[{if LANGUAGE_USE_INFORMAL_VARIANT}Dein{else}Ihr{/if} Google-Konto ist bereits mit einem anderen Benutzerkonto verknüpft.]]></item>
                <item name="wcf.user.3rdparty.google.disconnect"><![CDATA[Verknüpfung mit Google trennen]]></item>
                <item name="wcf.user.3rdparty.google.disconnect.success"><![CDATA[Die Verknüpfung mit {if LANGUAGE_USE_INFORMAL_VARIANT}deinem{else}Ihrem{/if} Google-Konto wurde erfolgreich getrennt.]]></item>
+               <item name="wcf.user.3rdparty.connect.info"><![CDATA[Der Benutzer ist mit {lang}wcf.user.3rdparty.{$user->getAuthProvider()}{/lang} verknüpft.]]></item>
        </category>
        <category name="wcf.user.avatar">
                <item name="wcf.user.avatar"><![CDATA[Avatar]]></item>
index a0a0281b5faea2cbb314393536e0e38045d3a662..e8e6141d9448c1c0596b630d08fc48860388f12b 100644 (file)
@@ -4841,6 +4841,7 @@ Open the link below to access the user profile:
                <item name="wcf.user.3rdparty.google.connect.error.inuse"><![CDATA[Your Google account is already connected to a different user.]]></item>
                <item name="wcf.user.3rdparty.google.disconnect"><![CDATA[Cancel connection with Google]]></item>
                <item name="wcf.user.3rdparty.google.disconnect.success"><![CDATA[Your account is no longer connected with Google.]]></item>
+               <item name="wcf.user.3rdparty.connect.info"><![CDATA[The user is connected with {lang}wcf.user.3rdparty.{$user->getAuthProvider()}{/lang}.]]></item>
        </category>
        <category name="wcf.user.avatar">
                <item name="wcf.user.avatar"><![CDATA[Avatar]]></item>