</h3>
{if $enabledMultifactorMethods[$method->objectTypeID]|isset}
- {$method->getProcessor()->getStatusText($enabledMultifactorMethods[$method->objectTypeID])}
+ {@$method->getProcessor()->getStatusText($enabledMultifactorMethods[$method->objectTypeID])}
{/if}
</div>
});
$this->multifactorMethods = ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.multifactor');
+
+ usort($this->multifactorMethods, function (ObjectType $a, ObjectType $b) {
+ return $b->priority <=> $a->priority;
+ });
+
$this->enabledMultifactorMethods = array_flip(array_map(function (ObjectType $o) {
return $o->objectTypeID;
}, WCF::getUser()->getEnabledMultifactorMethods()));
* Returns the number of remaining codes.
*/
public function getStatusText(int $setupId): string {
- $sql = "SELECT COUNT(*)
+ $sql = "SELECT COUNT(*) - COUNT(useTime) AS count, MAX(useTime) AS lastUsed
FROM wcf".WCF_N."_user_multifactor_backup
- WHERE setupID = ?
- AND useTime IS NULL";
+ WHERE setupID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$setupId]);
- // TODO: Language item
- return $statement->fetchSingleColumn()." codes remaining";
+ return WCF::getLanguage()->getDynamicVariable(
+ 'wcf.user.security.multifactor.backup.status',
+ $statement->fetchArray()
+ );
+
}
/**
* Returns the number of devices the user set up.
*/
public function getStatusText(int $setupId): string {
- $sql = "SELECT COUNT(*)
+ $sql = "SELECT COUNT(*) AS count, MAX(useTime) AS lastUsed
FROM wcf".WCF_N."_user_multifactor_totp
WHERE setupID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute([$setupId]);
- // TODO: Language item
- return $statement->fetchSingleColumn()." devices configured";
+ return WCF::getLanguage()->getDynamicVariable(
+ 'wcf.user.security.multifactor.totp.status',
+ $statement->fetchArray()
+ );
}
/**
<item name="wcf.user.security.sessionName"><![CDATA[{if $session->getUserAgent()->getBrowser()}{$session->getUserAgent()->getBrowser()}{if $session->getUserAgent()->getOS()} auf {$session->getUserAgent()->getOS()}{/if}{else}Unbekanntes Gerät{/if}]]></item>
<item name="wcf.user.security.ipAddress"><![CDATA[IP-Adresse]]></item>
<item name="wcf.user.security.lastActivity"><![CDATA[Sitzung zuletzt aktiv]]></item>
+ <item name="wcf.user.security.multifactor"><![CDATA[Mehrfaktor-Authentifizierung]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.totp"><![CDATA[Smartphone-App]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.backup"><![CDATA[Notfall-Codes]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.backup.manage"><![CDATA[Notfallcodes verwalten]]></item>
+ <item name="wcf.user.security.multifactor.backup.regenerateCodes"><![CDATA[Neue Codes generieren]]></item>
+ <item name="wcf.user.security.multifactor.backup.existingCodes"><![CDATA[Aktive Codes]]></item>
+ <item name="wcf.user.security.multifactor.backup.success"><![CDATA[Es wurden erfolgreich neue Codes generiert. Bestehende Codes sind nicht mehr gültig. Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}schreibe dir{else}schreiben Sie sich{/if} die Codes gut auf!]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.totp.manage"><![CDATA[Smartphone-App verwalten]]></item>
+ <item name="wcf.user.security.multifactor.totp.newDevice"><![CDATA[Smartphone hinzufügen]]></item>
+ <item name="wcf.user.security.multifactor.totp.deviceName"><![CDATA[Name des Geräts]]></item>
+ <item name="wcf.user.security.multifactor.totp.deviceName.placeholder"><![CDATA[Smartphone von {$__wcf->user->username}]]></item>
+ <item name="wcf.user.security.multifactor.totp.code"><![CDATA[Einmalcode]]></item>
+ <item name="wcf.user.security.multifactor.totp.status"><![CDATA[<ul class="inlineList small commaSeparated">
+<li>{plural value=$count 0="Nicht eingerichtet" 1="Ein Gerät eingerichtet" other="# Geräte eingerichtet"}</li>
+{if $lastUsed}<li>Am {@$lastUsed|plainTime} zuletzt verwendet</li>{/if}
+</ul>]]></item>
+ <item name="wcf.user.security.multifactor.backup.status"><![CDATA[<ul class="inlineList small commaSeparated">
+<li>{plural value=$count 0="Keine Codes verbleibend" 1="Ein Code verbleibend" other="# Codes verbleibend"}</li>
+{if $lastUsed}<li>Am {@$lastUsed|plainTime} zuletzt verwendet</li>{/if}
+</ul>]]></item>
+ <item name="wcf.user.security.multifactor.manage"><![CDATA[Verwalten]]></item>
+ <item name="wcf.user.security.multifactor.setup"><![CDATA[Einrichten]]></item>
+ <item name="wcf.user.security.multifactor.active"><![CDATA[Aktiv]]></item>
+ <item name="wcf.user.security.multifactor.backup.generateCodes"><![CDATA[Codes generieren]]></item>
</category>
<category name="wcf.user.trophy">
<item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophäen]]></item>
<item name="wcf.user.security.sessionName"><![CDATA[{if $session->getUserAgent()->getBrowser()}{$session->getUserAgent()->getBrowser()}{if $session->getUserAgent()->getOS()} on {$session->getUserAgent()->getOS()}{/if}{else}Unknown Device{/if}]]></item>
<item name="wcf.user.security.ipAddress"><![CDATA[IP Address]]></item>
<item name="wcf.user.security.lastActivity"><![CDATA[Last active]]></item>
+ <item name="wcf.user.security.multifactor"><![CDATA[Multifactor Authentication]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.totp"><![CDATA[Smartphone App]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.backup"><![CDATA[Emergency Codes]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.backup.manage"><![CDATA[Manage Emergency Codes]]></item>
+ <item name="wcf.user.security.multifactor.backup.regenerateCodes"><![CDATA[Generate New Codes]]></item>
+ <item name="wcf.user.security.multifactor.backup.existingCodes"><![CDATA[Active Codes]]></item>
+ <item name="wcf.user.security.multifactor.backup.success"><![CDATA[New Codes were generated successfully. Any existing codes are no longer valid. Please carefully note down the codes.]]></item>
+ <item name="wcf.user.security.multifactor.com.woltlab.wcf.multifactor.totp.manage"><![CDATA[Manage Smartphone App]]></item>
+ <item name="wcf.user.security.multifactor.totp.newDevice"><![CDATA[Add Smartphone]]></item>
+ <item name="wcf.user.security.multifactor.totp.deviceName"><![CDATA[Device Name]]></item>
+ <item name="wcf.user.security.multifactor.totp.deviceName.placeholder"><![CDATA[{$__wcf->user->username}’s Smartphone]]></item>
+ <item name="wcf.user.security.multifactor.totp.code"><![CDATA[One Time Code]]></item>
+ <item name="wcf.user.security.multifactor.totp.status"><![CDATA[<ul class="inlineList small commaSeparated">
+<li>{plural value=$count 0="Not set up" 1="One device set up" other="# devices set up"}</li>
+{if $lastUsed}<li>Last used on {@$lastUsed|plainTime}</li>{/if}
+</ul>]]></item>
+ <item name="wcf.user.security.multifactor.backup.status"><![CDATA[<ul class="inlineList small commaSeparated">
+<li>{plural value=$count 0="No codes remaining" 1="One code remaining" other="# codes remaining"}</li>
+{if $lastUsed}<li>Last used on {@$lastUsed|plainTime}</li>{/if}
+</ul>]]></item>
+ <item name="wcf.user.security.multifactor.manage"><![CDATA[Manage]]></item>
+ <item name="wcf.user.security.multifactor.setup"><![CDATA[Set Up]]></item>
+ <item name="wcf.user.security.multifactor.active"><![CDATA[Active]]></item>
+ <item name="wcf.user.security.multifactor.backup.generateCodes"><![CDATA[Generate Codes]]></item>
</category>
<category name="wcf.user.trophy">
<item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophies]]></item>