<name>com.woltlab.wcf.multifactor.totp</name>
<definitionname>com.woltlab.wcf.multifactor</definitionname>
<icon>mobile</icon>
- <!-- TODO: classname -->
+ <classname>wcf\system\user\multifactor\TotpMultifactorMethod</classname>
</type>
<!-- /multi factor -->
<!-- deprecated -->
</definition>
<definition>
<name>com.woltlab.wcf.multifactor</name>
- <!-- TODO: interfacename -->
+ <interfacename>wcf\system\user\multifactor\IMultifactorMethod</interfacename>
</definition>
</import>
<delete>
<div class="containerHeadline">
<h3>{lang}wcf.user.security.multifactor.{$method->objectType}{/lang}</h3>
- {$method|var_dump}
+ {$method->getProcessor()->getStatusText($__wcf->user)}
</div>
</div>
</li>
--- /dev/null
+<?php
+namespace wcf\system\user\multifactor;
+use wcf\data\user\User;
+
+/**
+ * Handles multifactor authentication for a specific authentication method.
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\System\User\Multifactor
+ * @since 5.4
+ */
+interface IMultifactorMethod {
+ /**
+ * Returns a human readable status text regarding the set-up status for the given user.
+ *
+ * An example text could be: "5 backup codes remaining".
+ */
+ public function getStatusText(User $user): string;
+}
--- /dev/null
+<?php
+namespace wcf\system\user\multifactor;
+use wcf\data\user\User;
+
+/**
+ * Implementation of the Time-based One-time Password Algorithm (RFC 6238).
+ *
+ * @author Tim Duesterhus
+ * @copyright 2001-2020 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package WoltLabSuite\System\User\Multifactor
+ * @since 5.4
+ */
+class TotpMultifactorMethod implements IMultifactorMethod {
+ /**
+ * Returns the number of devices the user set up.
+ */
+ public function getStatusText(User $user): string {
+ // TODO: Return a proper text.
+ return random_int(10000, 99999)." devices configured";
+ }
+}