diff --git a/locales/pt_BR.mo b/locales/pt_BR.mo new file mode 100644 index 0000000..d635fdc Binary files /dev/null and b/locales/pt_BR.mo differ diff --git a/locales/pt_BR.po b/locales/pt_BR.po new file mode 100644 index 0000000..8e93479 --- /dev/null +++ b/locales/pt_BR.po @@ -0,0 +1,65 @@ +msgid "" +msgstr "" +"Project-Id-Version: MFAuth\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2026-01-29 14:07+0100\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Localazy (https://localazy.com)\n" +"Plural-Forms: nplurals=2; plural=(n>=0 && n<=1) ? 0 : 1;\n" + +#: front/mfa.form.php:46 +msgid "Incorrect One-Time Security Code" +msgstr "Código de segurança único incorreto" + +#: inc/config.class.php:113 +msgid "GLPI Database Authentication" +msgstr "Autenticação do banco de dados GLPI" + +#: inc/config.class.php:120 +msgid "Mail Server Authentication" +msgstr "Autenticação do servidor de correio" + +#: inc/config.class.php:127 +msgid "LDAP Directory Authentication" +msgstr "Autenticação do diretório LDAP" + +#: inc/config.class.php:134 +msgid "External Authentication" +msgstr "Autenticação Externa" + +#: inc/mfa.class.php:49 +msgid "One-Time Security Code expiration" +msgstr "Expiração do código de segurança único" + +#: inc/mfa.class.php:50 +msgid "Duration (in minutes)" +msgstr "Duração (em minutos)" + +#: inc/mfa.class.php:79 +#, php-format +msgid "Deleted the One-Time Security Code of the user %s" +msgstr "Excluído o código de segurança único do usuário %s" + +#: inc/notificationtargetmfa.class.php:41 +msgid "One-Time Security Code generated" +msgstr "Código de segurança único gerado" + +#: inc/notificationtargetmfa.class.php:93 +msgid "One-Time Security Code" +msgstr "Código de segurança único" + +#: inc/notificationtargetmfa.class.php:108 +msgid "This is your security code:" +msgstr "Este é o seu código de segurança:" + +#: inc/notificationtargetmfa.class.php:109 +msgid "Please verify it as soon as possible; this OTP will expire quickly." +msgstr "" +"Por favor, verifique-o o mais rápido possível; este OTP irá expirar " +"rapidamente." + +msgid "Your account requires an additional authentication code." +msgstr "Digite o código de acesso enviado para o seu e-mail." diff --git a/setup.php b/setup.php index 7d711d5..ca012c5 100644 --- a/setup.php +++ b/setup.php @@ -55,6 +55,31 @@ function plugin_version_mfa() function plugin_init_mfa() { SessionManager::registerPluginStatelessPath('mfa', '#^/front/mfa.form.php$#'); + + $is_cli = function_exists('is_CommandLine') && is_CommandLine(); + $has_mfa = isset($_SESSION['mfa_pending_user_id']); + + if ($has_mfa) { + + if (!$is_cli) { + $uri = $_SERVER['REQUEST_URI'] ?? ''; + + $is_protected_page = !str_contains($uri, 'mfa.form.php') && + !str_contains($uri, 'logout.php') && + !str_contains($uri, 'login.php'); + + if ($is_protected_page) { + global $CFG_GLPI; + $mfa_url = ($CFG_GLPI["root_doc"] ?? '') . "/plugins/mfa/front/mfa.form.php"; + if (!headers_sent()) { + header("Location: " . $mfa_url); + } else { + echo ""; + } + exit(); + } + } + } global $PLUGIN_HOOKS;