2FA totp, bugfix
This commit is contained in:
@@ -55,7 +55,6 @@ namespace Core\API\Mail {
|
||||
use Core\External\PHPMailer\PHPMailer;
|
||||
use Core\Objects\Context;
|
||||
use Core\Objects\DatabaseEntity\GpgKey;
|
||||
use PhpParser\Node\Param;
|
||||
|
||||
class Test extends MailAPI {
|
||||
|
||||
|
||||
@@ -62,6 +62,7 @@ namespace Core\API\TFA {
|
||||
use Core\API\Parameter\StringType;
|
||||
use Core\API\TfaAPI;
|
||||
use Core\Driver\SQL\Condition\Compare;
|
||||
use Core\Driver\SQL\Query\Insert;
|
||||
use Core\Objects\Context;
|
||||
use Core\Objects\TwoFactor\AttestationObject;
|
||||
use Core\Objects\TwoFactor\AuthenticationData;
|
||||
@@ -131,6 +132,10 @@ namespace Core\API\TFA {
|
||||
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users to remove their 2FA-Tokens", true);
|
||||
}
|
||||
}
|
||||
|
||||
// TOTP
|
||||
@@ -167,11 +172,16 @@ namespace Core\API\TFA {
|
||||
$this->disableCache();
|
||||
die($twoFactorToken->generateQRCode($this->context));
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users generate a QR-code to add a time-based 2FA-Token", true);
|
||||
}
|
||||
}
|
||||
|
||||
class ConfirmTotp extends VerifyTotp {
|
||||
public function __construct(Context $context, bool $externalCall = false) {
|
||||
parent::__construct($context, $externalCall);
|
||||
$this->loginRequired = true;
|
||||
}
|
||||
|
||||
public function _execute(): bool {
|
||||
@@ -196,6 +206,10 @@ namespace Core\API\TFA {
|
||||
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users to confirm their time-based 2FA-Token", true);
|
||||
}
|
||||
}
|
||||
|
||||
class VerifyTotp extends TfaAPI {
|
||||
@@ -211,10 +225,6 @@ namespace Core\API\TFA {
|
||||
public function _execute(): bool {
|
||||
|
||||
$currentUser = $this->context->getUser();
|
||||
if (!$currentUser) {
|
||||
return $this->createError("You are not logged in.");
|
||||
}
|
||||
|
||||
$twoFactorToken = $currentUser->getTwoFactorToken();
|
||||
if (!$twoFactorToken) {
|
||||
return $this->createError("You did not add a two factor token yet.");
|
||||
@@ -230,6 +240,10 @@ namespace Core\API\TFA {
|
||||
$twoFactorToken->authenticate();
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users to verify time-based 2FA-Tokens", true);
|
||||
}
|
||||
}
|
||||
|
||||
// Key
|
||||
@@ -326,6 +340,10 @@ namespace Core\API\TFA {
|
||||
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users to register a 2FA hardware-key", true);
|
||||
}
|
||||
}
|
||||
|
||||
class VerifyKey extends TfaAPI {
|
||||
@@ -384,5 +402,9 @@ namespace Core\API\TFA {
|
||||
|
||||
return $this->success;
|
||||
}
|
||||
|
||||
public static function getDefaultACL(Insert $insert): void {
|
||||
$insert->addRow(self::getEndpoint(), [], "Allows users to verify a 2FA hardware-key", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,6 +90,8 @@ return [
|
||||
"gpg_key_placeholder_text" => "GPG-Key im ASCII format reinziehen oder einfügen...",
|
||||
|
||||
# 2fa
|
||||
"2fa_type_totp" => "Zeitbasiertes 2FA (TOTP)",
|
||||
"2fa_type_fido" => "Schlüsselbasiertes 2FA",
|
||||
"register_2fa_device" => "Ein 2FA-Gerät registrieren",
|
||||
"register_2fa_totp_text" => "Scan den QR-Code mit einem Gerät, das du als Zwei-Faktor-Authentifizierung (2FA) benutzen willst. " .
|
||||
"Unter Android kannst du den Google Authenticator benutzen.",
|
||||
|
||||
@@ -35,6 +35,7 @@ return [
|
||||
"no" => "Nein",
|
||||
"create_new" => "Erstellen",
|
||||
"unchanged" => "Unverändert",
|
||||
"click_to_copy" => "Klicken zum Kopieren",
|
||||
|
||||
# dialog / actions
|
||||
"action" => "Aktion",
|
||||
|
||||
@@ -90,6 +90,8 @@ return [
|
||||
"gpg_key_placeholder_text" => "Paste or drag'n'drop your GPG-Key in ASCII format...",
|
||||
|
||||
# 2fa
|
||||
"2fa_type_totp" => "Time-Based 2FA (TOTP)",
|
||||
"2fa_type_fido" => "Key-Based 2FA",
|
||||
"register_2fa_device" => "Register a 2FA-Device",
|
||||
"register_2fa_totp_text" => "Scan the QR-Code with a device you want to use for Two-Factor-Authentication (2FA). " .
|
||||
"On Android, you can use the Google Authenticator.",
|
||||
|
||||
@@ -17,6 +17,7 @@ return [
|
||||
"no" => "No",
|
||||
"create_new" => "Create",
|
||||
"unchanged" => "Unchanged",
|
||||
"click_to_copy" => "Click to copy",
|
||||
|
||||
# dialog / actions
|
||||
"action" => "Action",
|
||||
|
||||
Reference in New Issue
Block a user