Integrate multifactor into AccountSecurityPage
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 2 Nov 2020 13:41:30 +0000 (14:41 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Nov 2020 10:07:04 +0000 (11:07 +0100)
com.woltlab.wcf/objectType.xml
com.woltlab.wcf/templates/accountSecurity.tpl
wcfsetup/install/files/lib/page/AccountSecurityPage.class.php

index 7fbbcab75cee35650d07c1f823d928e8206b026d..3ad90f17004c612a58701f39c51d9a9eaf1cfcbf 100644 (file)
                <type>
                        <name>com.woltlab.wcf.multifactor.totp</name>
                        <definitionname>com.woltlab.wcf.multifactor</definitionname>
+                       <icon>mobile</icon>
                        <!-- TODO: classname -->
                </type>
                <!-- /multi factor -->
index d93e540c9b9155b794a2c750ad93a611de33fff0..12bc297d72c1f0d932f098a59582180709657b70 100644 (file)
@@ -2,6 +2,28 @@
 
 {include file='header' __disableAds=true __sidebarLeftHasMenu=true}
 
+<section class="section">
+       <h2 class="sectionTitle">{lang}wcf.user.security.multifactor{/lang}</h2>
+       
+       <ul class="containerList">
+               {foreach from=$multifactorMethods item=method}
+                       <li class="box64">
+                               <div>
+                                       <span class="icon icon64 fa-{if $method->icon}{$method->icon}{else}lock{/if}"></span>
+                               </div>
+                               
+                               <div>
+                                       <div class="containerHeadline">
+                                               <h3>{lang}wcf.user.security.multifactor.{$method->objectType}{/lang}</h3>
+                                               
+                                               {$method|var_dump}
+                                       </div>
+                               </div>
+                       </li>
+               {/foreach}
+       </ul>
+</section>
+
 <section class="section">
        <h2 class="sectionTitle">{lang}wcf.user.security.activeSessions{/lang}</h2>
        
index 5b70f656d2a9b377295d6f245f0545cdd2f437f0..b9711c288254d218c45a8f3c342b5baf08f06834 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 namespace wcf\page;
+use wcf\data\object\type\ObjectType;
+use wcf\data\object\type\ObjectTypeCache;
 use wcf\system\menu\user\UserMenu;
 use wcf\system\session\Session;
 use wcf\system\session\SessionHandler;
@@ -8,7 +10,7 @@ use wcf\system\WCF;
 /**
  * Shows the account security page.
  *
- * @author     Joshua Ruesweg
+ * @author     Tim Duesterhus, Joshua Ruesweg
  * @copyright  2001-2020 WoltLab GmbH
  * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
  * @package    WoltLabSuite\Core\Page
@@ -25,6 +27,11 @@ class AccountSecurityPage extends AbstractPage {
         */
        private $activeSessions;
        
+       /**
+        * @var ObjectType[]
+        */
+       private $multifactorMethods;
+       
        /**
         * @inheritDoc
         */
@@ -36,6 +43,8 @@ class AccountSecurityPage extends AbstractPage {
                usort($this->activeSessions, function ($a, $b) {
                        return $b->getLastActivityTime() <=> $a->getLastActivityTime();
                });
+               
+               $this->multifactorMethods = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.multifactor');
        }
        
        /**
@@ -45,7 +54,8 @@ class AccountSecurityPage extends AbstractPage {
                parent::assignVariables();
                
                WCF::getTPL()->assign([
-                       'activeSessions' => $this->activeSessions
+                       'activeSessions' => $this->activeSessions,
+                       'multifactorMethods' => $this->multifactorMethods,
                ]);
        }