OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Show i18n error message for the abortError
Klaus Zanders8308862f5150
diff --git a/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts b/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.tsindex c39387b02fc..ac7e1e4a075 100644--- a/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/two-factor-authentication.controller.ts@@ -48,6 +48,7 @@ export default class TwoFactorAuthenticationController extends Controller {return true;}+ this.clearError();event.preventDefault();try {@@ -67,7 +68,7 @@ export default class TwoFactorAuthenticationController extends Controller {return true;} catch (error) {- this.errorDisplayTarget.innerText = `Error registering device: ${error}`;+ this.displayError(error);return false;}}@@ -81,6 +82,7 @@ export default class TwoFactorAuthenticationController extends Controller {return true;}+ this.clearError();event.preventDefault();try {@@ -100,7 +102,7 @@ export default class TwoFactorAuthenticationController extends Controller {return true;} catch (error) {- this.errorDisplayTarget.innerText = `Error registering device: ${error}`;+ this.displayError(error);return false;}}@@ -128,4 +130,16 @@ export default class TwoFactorAuthenticationController extends Controller {evt.preventDefault();this.resendOptionsTarget.hidden = !this.resendOptionsTarget.hidden;}++ private displayError(error:DOMException) {+ let errorMessage = `Error registering device: ${error.message}`;+ if (error.name === 'AbortError') {+ errorMessage = I18n.t('js.two_factor_authentication.errors.aborted');+ }+ this.errorDisplayTarget.innerText = errorMessage;+ }++ private clearError() {+ this.errorDisplayTarget.innerText = '';+ }}diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/authentication/request_otp.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/authentication/request_otp.html.erbindex 01479d5798e..9dcbe71a567 100644--- a/modules/two_factor_authentication/app/views/two_factor_authentication/authentication/request_otp.html.erb+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/authentication/request_otp.html.erb@@ -31,7 +31,7 @@<p><%= raw I18n.t('two_factor_authentication.devices.2fa_from_webauthn', device_name: identifier) %></p><hr class="form--separator"><%= hidden_field_tag 'webauthn_credential', nil, "data-two-factor-authentication-target": "webauthnCredential" %>- <div class="form--field-error" data-two-factor-authentication-target="errorField"></div>+ <div class="form--field-error" data-two-factor-authentication-target="errorDisplay"></div><% end %><% if remember_2fa_enabled? %><div class="form--field -wide-label">diff --git a/modules/two_factor_authentication/config/locales/js-en.yml b/modules/two_factor_authentication/config/locales/js-en.ymlnew file mode 100644index 00000000000..54e16451ba4--- /dev/null+++ b/modules/two_factor_authentication/config/locales/js-en.yml@@ -0,0 +1,32 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#+++en:+ js:+ two_factor_authentication:+ errors:+ aborted: "The authentication was cancelled. Please try again."