Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-93: add an option to turn off the old U2F provider #102

Merged
merged 1 commit into from
May 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions inc/class-adminsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,17 @@ public function register_settings(): void {
),
]
);

add_settings_field(
'disable_u2f',
__( 'Disable old U2F provider', 'two-factor-provider-webauthn' ),
[ $this->input_factory, 'checkbox' ],
Admin::OPTIONS_MENU_SLUG,
$settings_section,
[
'label_for' => 'disable_u2f',
'help' => __( 'This option allows you to turn off the old U2F provider in the Two Factor plugin.', 'two-factor-provider-webauthn' ),
]
);
}
}
7 changes: 7 additions & 0 deletions inc/class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace WildWolf\WordPress\TwoFactorWebAuthn;

use Two_Factor_FIDO_U2F;
use TwoFactor_Provider_WebAuthn;
use WildWolf\Utils\Singleton;

Expand Down Expand Up @@ -34,6 +35,12 @@ public function init(): void {
*/
public function two_factor_providers( array $providers ): array {
$providers[ TwoFactor_Provider_WebAuthn::class ] = __DIR__ . '/class-twofactor-provider-webauthn.php';

$disable_u2f = Settings::instance()->get_disable_u2f();
if ( $disable_u2f ) {
unset( $providers[ Two_Factor_FIDO_U2F::class ] );
}

return $providers;
}

Expand Down
8 changes: 7 additions & 1 deletion inc/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
* authenticator_attachment: string,
* user_verification_requirement: string,
* timeout: int,
* u2f_hack: bool
* u2f_hack: bool,
* disable_u2f: bool,
* }
*
* @template-implements ArrayAccess<string, scalar>
Expand All @@ -31,6 +32,7 @@ final class Settings implements ArrayAccess {
'user_verification_requirement' => 'preferred',
'timeout' => 0,
'u2f_hack' => true,
'disable_u2f' => false,
];

/**
Expand Down Expand Up @@ -116,4 +118,8 @@ public function get_timeout(): int {
public function get_u2f_hack(): bool {
return $this->options['u2f_hack'];
}

public function get_disable_u2f(): bool {
return $this->options['disable_u2f'];
}
}
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Plugin Name: WebAuthn Provider for Two Factor
* Description: WebAuthn Provider for Two Factor plugin.
* Version: 1.0.3
* Version: 1.0.4
* Author: Volodymyr Kolesnykov
* License: MIT
* Text Domain: two-factor-provider-webauthn
Expand Down
Binary file modified lang/two-factor-provider-webauthn-ru_RU.mo
Binary file not shown.
33 changes: 24 additions & 9 deletions lang/two-factor-provider-webauthn-ru_RU.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
msgid ""
msgstr ""
"Project-Id-Version: WebAuthn Provider for Two Factor 1.0.0\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/two-factor-"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-two-factor-"
"provider-webauthn\n"
"POT-Creation-Date: 2022-02-21T21:24:41+02:00\n"
"POT-Creation-Date: 2022-05-17T07:26:06+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -94,6 +94,11 @@ msgid ""
"em>: user verification is required for successful authentication. Please "
"note that not all browsers support this setting.<br/>"
msgstr ""
"<em>Не проверять</em>: проверка пользователя не требуется (например, по соображениям "
"сведения к минимуму вмешательств в процесс взаимодействия с пользователем).<br/"
"><em>По возможности</em>: проверка пользователя (например, ввод PIN-кода) "
"может выполняться, но не является необходимой для успешной аутентификации.<br/><em>Проверять</"
"em>: проверка пользователя необходима для успешной аутентификации. Обратите внимение, что не все браузеры поддерживают данную опцию.<br/>"

#: inc/class-adminsettings.php:94
msgid "Timeout"
Expand Down Expand Up @@ -124,31 +129,41 @@ msgstr ""
"зарегистрирован при помощи U2F; если да, то поддержка AppID включается "
"принудительно."

#: inc/class-ajax.php:33
#: inc/class-adminsettings.php:127
msgid "Disable old U2F provider"
msgstr ""

#: inc/class-adminsettings.php:133
msgid ""
"This option allows you to turn off the old U2F provider in the Two Factor "
"plugin."
msgstr "Данная опция позволяет отключить старый провайдер U2F в плагине Two Factor."

#: inc/class-ajax.php:32
msgid "The nonce has expired. Please reload the page and try again."
msgstr ""
"Срок действия одноразового номера истёк. Пожалуйста, обновите страницу и "
"попытайтесь выполнить действие снова."

#: inc/class-ajax.php:85
#: inc/class-ajax.php:84
msgid "Unable to retrieve the registration context."
msgstr "Не удалось получить контекст регистрации."

#: inc/class-ajax.php:95 inc/class-ajax.php:124
#: inc/class-ajax.php:94 inc/class-ajax.php:123
#: inc/class-webauthn-provider.php:118
msgid "Bad request."
msgstr "Неверный запрос."

#: inc/class-ajax.php:111
#: inc/class-ajax.php:110
#, fuzzy
msgid "Unable to save the key to the database."
msgstr "Не удалось получить контекст регистрации."

#: inc/class-ajax.php:151
#: inc/class-ajax.php:150
msgid "Key name cannot be empty."
msgstr "Имя ключа не может быть пустым."

#: inc/class-ajax.php:160
#: inc/class-ajax.php:159
msgid "Failed to rename the key."
msgstr "Не удалось переименовать ключ."

Expand Down Expand Up @@ -199,7 +214,7 @@ msgstr "Не удалось получить контекст аутентифи

#: inc/class-webauthn-user.php:52
msgid "Unable to save the user handle to the database."
msgstr ""
msgstr "Не удалось сохранить дескриптор пользователя в базу данных."

#: views/login.php:2
msgid "Please insert (and tap) your security key."
Expand Down
28 changes: 18 additions & 10 deletions lang/two-factor-provider-webauthn.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: WebAuthn Provider for Two Factor 1.0.3\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/two-factor-provider-webauthn\n"
"Project-Id-Version: WebAuthn Provider for Two Factor 1.0.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/wp-two-factor-provider-webauthn\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2022-02-21T21:24:41+02:00\n"
"POT-Creation-Date: 2022-05-17T07:36:42+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.6.0\n"
"X-Domain: two-factor-provider-webauthn\n"
Expand Down Expand Up @@ -96,29 +96,37 @@ msgstr ""
msgid "Chrome for Android sometimes ignores the AppID extension required for interoperability between the old U2F and the modern WebAuthn protocol.<br/>When enabled, this hack enables the check whether the security key used was registered with U2F and if so, forces the use of the AppID extension."
msgstr ""

#: inc/class-ajax.php:33
#: inc/class-adminsettings.php:127
msgid "Disable old U2F provider"
msgstr ""

#: inc/class-adminsettings.php:133
msgid "This option allows you to turn off the old U2F provider in the Two Factor plugin."
msgstr ""

#: inc/class-ajax.php:32
msgid "The nonce has expired. Please reload the page and try again."
msgstr ""

#: inc/class-ajax.php:85
#: inc/class-ajax.php:84
msgid "Unable to retrieve the registration context."
msgstr ""

#: inc/class-ajax.php:95
#: inc/class-ajax.php:124
#: inc/class-ajax.php:94
#: inc/class-ajax.php:123
#: inc/class-webauthn-provider.php:118
msgid "Bad request."
msgstr ""

#: inc/class-ajax.php:111
#: inc/class-ajax.php:110
msgid "Unable to save the key to the database."
msgstr ""

#: inc/class-ajax.php:151
#: inc/class-ajax.php:150
msgid "Key name cannot be empty."
msgstr ""

#: inc/class-ajax.php:160
#: inc/class-ajax.php:159
msgid "Failed to rename the key."
msgstr ""

Expand Down
6 changes: 6 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ Be the first to ask.

== Changelog ==

= 1.0.4 =
* Update translations
* GH-93: add an option to turn off the old U2F provider
* Update dependencies
* Add more E2E tests

= 1.0.3 =
* GH-33: increase length of credential_id column to solve issues with Chrome on Mac
* GH-38: fix bugs preventing plugin uninstallation
Expand Down