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
[53807] Update PageHeaders & SubHeaders in the My account pages (#16141)
Behrokh Satarnejad6c6ba1e08a1a
diff --git a/app/components/users/delete_page_header_component.html.erb b/app/components/users/delete_page_header_component.html.erbnew file mode 100644index 00000000000..a732ba75b10--- /dev/null+++ b/app/components/users/delete_page_header_component.html.erb@@ -0,0 +1,34 @@+<%#-- 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.++++#%>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t("account.delete") }+ header.with_breadcrumbs(breadcrumb_items)+ end+%>diff --git a/app/components/users/delete_page_header_component.rb b/app/components/users/delete_page_header_component.rbnew file mode 100644index 00000000000..e9ba1d5ff9b--- /dev/null+++ b/app/components/users/delete_page_header_component.rb@@ -0,0 +1,52 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2010-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.+# ++++class Users::DeletePageHeaderComponent < ApplicationComponent+ include OpPrimer::ComponentHelpers+ include ApplicationHelper++ def initialize(user:, layout:)+ super+ @user = user+ @layout = layout+ end++ def breadcrumb_items+ if @layout == "my"+ [{ href: my_account_path, text: t(:label_my_account) }, t("account.delete")]+ else+ [{ href: admin_index_path, text: t(:label_administration) },+ { href: admin_settings_users_path, text: t(:label_user_and_permission) },+ { href: users_path, text: t(:label_user_plural) },+ { href: edit_user_path(@user), text: @user.name },+ t("account.delete")]+ end+ end+enddiff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rbindex d591e9d200b..f0d6ccdba04 100644--- a/app/controllers/my_controller.rb+++ b/app/controllers/my_controller.rb@@ -113,26 +113,10 @@ class MyController < ApplicationControllerend# Configure user's in app notifications- def notifications- render html: "",- layout: "angular/angular",- locals: {- menu_name: :my_menu,- component: "opce-notification-settings",- page_title: [I18n.t(:label_my_account), I18n.t("js.notifications.settings.title")]- }- end+ def notifications; end# Configure user's mail reminders- def reminders- render html: "",- layout: "angular/angular",- locals: {- menu_name: :my_menu,- component: "opce-reminder-settings",- page_title: [I18n.t(:label_my_account), I18n.t("js.reminders.settings.title")]- }- end+ def reminders; end# Create a new feeds keydef generate_rss_keydiff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rbindex 1fc329c015b..006335e2d3c 100644--- a/app/controllers/users_controller.rb+++ b/app/controllers/users_controller.rb@@ -219,7 +219,7 @@ class UsersController < ApplicationControllerenddef deletion_info- render action: "deletion_info", layout: my_or_admin_layout+ render action: "deletion_info", layout: my_or_admin_layout, locals: { layout: my_or_admin_layout }endprivatediff --git a/app/views/my/access_token.html.erb b/app/views/my/access_token.html.erbindex d20a442c507..f974a8639dc 100644--- a/app/views/my/access_token.html.erb+++ b/app/views/my/access_token.html.erb@@ -29,30 +29,32 @@ See COPYRIGHT and LICENSE files for more details.<% html_title(t(:label_my_account), I18n.t('my_account.access_tokens.access_tokens')) -%>-<% breadcrumb_paths(t(:label_my_account), I18n.t('my_account.access_tokens.access_tokens')) %>--<div class="access-token-page--container">- <%= toolbar title: I18n.t('my_account.access_tokens.access_tokens') %>-- <%= render ::My::AccessToken::APITokensSectionComponent.new(api_tokens: @user.api_tokens) %>- <%= render partial: 'my/access_token_partials/icalendar_tokens_section',- locals: { ical_tokens_grouped_by_query: @ical_tokens_grouped_by_query }- %>- <%= render partial: 'my/access_token_partials/oauth_tokens_section',- locals: { granted_applications: granted_applications }- %>- <%= render partial: 'my/access_token_partials/rss_tokens_section',- locals: { rss_token: @user.rss_token }- %>- <%= render partial: 'my/access_token_partials/storage_tokens_section',- locals: { storage_tokens: @storage_tokens }- %>- <div class="generic-table--container">- <div class="generic-table--results-container">- <table class="generic-table">- <%= call_hook(:view_access_tokens_table, user: @user) %>- </table>- </div>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { I18n.t('my_account.access_tokens.access_tokens') }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ I18n.t('my_account.access_tokens.access_tokens')])+ end+%>++<%= render ::My::AccessToken::APITokensSectionComponent.new(api_tokens: @user.api_tokens) %>+<%= render partial: 'my/access_token_partials/icalendar_tokens_section',+ locals: { ical_tokens_grouped_by_query: @ical_tokens_grouped_by_query }+%>+<%= render partial: 'my/access_token_partials/oauth_tokens_section',+ locals: { granted_applications: granted_applications }+%>+<%= render partial: 'my/access_token_partials/rss_tokens_section',+ locals: { rss_token: @user.rss_token }+%>+<%= render partial: 'my/access_token_partials/storage_tokens_section',+ locals: { storage_tokens: @storage_tokens }+%>+<div class="generic-table--container">+ <div class="generic-table--results-container">+ <table class="generic-table">+ <%= call_hook(:view_access_tokens_table, user: @user) %>+ </table></div></div>diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erbindex 56b701d800b..dbffe52a7b1 100644--- a/app/views/my/account.html.erb+++ b/app/views/my/account.html.erb@@ -29,8 +29,14 @@ See COPYRIGHT and LICENSE files for more details.<% html_title(t(:label_my_account), t(:label_profile)) -%>-<% breadcrumb_paths(t(:label_my_account), t(:label_profile)) %>-<%= toolbar title: t(:label_profile) %>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t(:label_profile) }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t(:label_profile)])+ end+%>+<%= error_messages_for 'user' %><%= password_confirmation_form_for @user,diff --git a/app/views/my/notifications.html.erb b/app/views/my/notifications.html.erbnew file mode 100644index 00000000000..98c0331d930--- /dev/null+++ b/app/views/my/notifications.html.erb@@ -0,0 +1,40 @@+<%#-- 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.++++#%>++<% html_title(t(:label_my_account), I18n.t("js.notifications.settings.title")) -%>++<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { I18n.t("js.notifications.settings.title") }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ I18n.t("js.notifications.settings.title")])+ end+%>++<%= angular_component_tag "opce-notification-settings" %>diff --git a/app/views/my/password.html.erb b/app/views/my/password.html.erbindex 8cc157ad218..81be4364a82 100644--- a/app/views/my/password.html.erb+++ b/app/views/my/password.html.erb@@ -27,8 +27,14 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title t(:label_my_account), t(:button_change_password) %>-<% breadcrumb_paths(t(:label_my_account), t(:button_change_password)) %>-<%= toolbar title: t(:button_change_password) %>++<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title(test_selector: "change_password_header_title") { t(:button_change_password) }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t(:button_change_password)])+ end+%><%= error_messages_for 'user' %><%= styled_form_tag({ action: :change_password },diff --git a/app/views/my/reminders.html.erb b/app/views/my/reminders.html.erbnew file mode 100644index 00000000000..a1f7177d3b7--- /dev/null+++ b/app/views/my/reminders.html.erb@@ -0,0 +1,40 @@+<%#-- 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.++++#%>++<% html_title(t(:label_my_account), I18n.t("js.reminders.settings.title")) -%>++<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { I18n.t("js.reminders.settings.title") }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ I18n.t("js.reminders.settings.title")])+ end+%>++<%= angular_component_tag "opce-reminder-settings" %>diff --git a/app/views/my/sessions/index.html.erb b/app/views/my/sessions/index.html.erbindex d4ff5868d11..518cd763d4c 100644--- a/app/views/my/sessions/index.html.erb+++ b/app/views/my/sessions/index.html.erb@@ -28,7 +28,13 @@ See COPYRIGHT and LICENSE files for more details.++#%><% html_title(t('users.sessions.title')) -%>-<%= toolbar title: t('users.sessions.title') -%>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t('users.sessions.title') }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t('users.sessions.title')])+ end+%><p><%= t('users.sessions.instructions') %></p>diff --git a/app/views/my/settings.html.erb b/app/views/my/settings.html.erbindex 3f6b90d0cb3..63f528d92f2 100644--- a/app/views/my/settings.html.erb+++ b/app/views/my/settings.html.erb@@ -29,8 +29,13 @@ See COPYRIGHT and LICENSE files for more details.<% html_title(t(:label_my_account), t(:label_setting_plural)) %>-<% breadcrumb_paths(t(:label_my_account), t(:label_setting_plural)) %>-<%= toolbar title: t(:label_setting_plural) %>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t(:label_setting_plural) }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t(:label_setting_plural)])+ end+%><%= error_messages_for 'user' %><%= labelled_tabular_form_for @user, as: :user, url: { action: 'update_settings' },diff --git a/app/views/users/_notifications.html.erb b/app/views/users/_notifications.html.erbindex 8b36936dfe7..24c7dde5162 100644--- a/app/views/users/_notifications.html.erb+++ b/app/views/users/_notifications.html.erb@@ -26,4 +26,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<%= angular_component_tag "opce-notification-settings", inputs: { userId: @user.id, showToolbar: false } %>+<%= angular_component_tag "opce-notification-settings", inputs: { userId: @user.id } %>diff --git a/app/views/users/_reminders.html.erb b/app/views/users/_reminders.html.erbindex eec20748640..bb5d1fb15d0 100644--- a/app/views/users/_reminders.html.erb+++ b/app/views/users/_reminders.html.erb@@ -26,4 +26,4 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<%= angular_component_tag "opce-reminder-settings", inputs: { userId: @user.id, show_toolbar: false } %>+<%= angular_component_tag "opce-reminder-settings", inputs: { userId: @user.id } %>diff --git a/app/views/users/deletion_info.html.erb b/app/views/users/deletion_info.html.erbindex b568f5e3185..cbc04f0e94d 100644--- a/app/views/users/deletion_info.html.erb+++ b/app/views/users/deletion_info.html.erb@@ -26,7 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.See COPYRIGHT and LICENSE files for more details.++#%>-<% html_title(t(:label_administration), "#{ t('account.deletion_info.heading', name: @user.name)}") -%>+<% layout = local_assigns[:layout] %>++<% html_title(layout== "my" ? t(:label_my_account) : t(:label_administration), "#{ t('account.deletion_info.heading', name: @user.name)}") -%>++<%= render ::Users::DeletePageHeaderComponent.new(layout: layout, user: @user) %><%= labelled_tabular_form_for(:user,diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.htmlindex 254e4e3593f..5693d6aff23 100644--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.html@@ -1,4 +1,3 @@-<op-notifications-settings-toolbar *ngIf="showToolbar"></op-notifications-settings-toolbar><form[formGroup]="form"(ngSubmit)="saveChanges()"diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.tsindex b23146cbbd6..3e2b31a49f7 100644--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts@@ -50,8 +50,6 @@ interface IFullNotificationSettingsValue extends IToastSettingsValue {export class NotificationsSettingsPageComponent extends UntilDestroyedMixin implements OnInit {@Input() userId:string;- @Input() showToolbar = true;-public availableTimes = reminderAvailableTimeframes();public availableTimesOverdue = overDueReminderTimes();diff --git a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.html b/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.htmldeleted file mode 100644index 91ec548e193..00000000000--- a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.html+++ /dev/null@@ -1,7 +0,0 @@-<div class="toolbar-container">- <div class="toolbar">- <div class="title-container">- <h2 [textContent]="text.title"></h2>- </div>- </div>-</div>diff --git a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.tsdeleted file mode 100644index 312d5a3e703..00000000000--- a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts+++ /dev/null@@ -1,33 +0,0 @@-import {- ChangeDetectionStrategy,- Component,-} from '@angular/core';-import { I18nService } from 'core-app/core/i18n/i18n.service';-import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';--@Component({- selector: 'op-notifications-settings-toolbar',- templateUrl: './notifications-settings-toolbar.component.html',- changeDetection: ChangeDetectionStrategy.OnPush,-})-export class NotificationsSettingsToolbarComponent {- projectSettings$ = this.storeService.query.projectNotifications$;-- text = {- title: this.I18n.t('js.notifications.settings.title'),- };-- constructor(- private storeService:UserPreferencesService,- private I18n:I18nService,- ) {- }-- removeAll():void {- this.storeService.store.update(- ({ notifications }) => ({- notifications: notifications.filter((notification) => notification._links.project.href === null),- }),- );- }-}diff --git a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.html b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.htmlindex c754e2dc218..0808073d085 100644--- a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.html+++ b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.html@@ -1,11 +1,3 @@-<div class="toolbar-container" *ngIf="showToolbar">- <div class="toolbar">- <div class="title-container">- <h2 [textContent]="text.title"></h2>- </div>- </div>-</div>-<form*ngIf="formInitialized"[formGroup]="form"diff --git a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.tsindex e0ad947ee4f..8d271291f78 100644--- a/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts+++ b/frontend/src/app/features/user-preferences/reminder-settings/page/reminder-settings-page.component.ts@@ -36,8 +36,6 @@ interface IReminderSettingsFormValue {export class ReminderSettingsPageComponent extends UntilDestroyedMixin implements OnInit {@Input() userId:string;- @Input() showToolbar = true;-public form = this.fb.group({immediateReminders: this.fb.group({mentioned: this.fb.control(false),diff --git a/frontend/src/app/features/user-preferences/user-preferences.module.ts b/frontend/src/app/features/user-preferences/user-preferences.module.tsindex 79ebd491751..798475a234d 100644--- a/frontend/src/app/features/user-preferences/user-preferences.module.ts+++ b/frontend/src/app/features/user-preferences/user-preferences.module.ts@@ -12,9 +12,6 @@ import {import {NotificationSettingInlineCreateComponent,} from 'core-app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component';-import {- NotificationsSettingsToolbarComponent,-} from './notifications-settings/toolbar/notifications-settings-toolbar.component';import {NotificationSettingsTableComponent,} from './notifications-settings/table/notification-settings-table.component';@@ -38,7 +35,6 @@ import { PauseRemindersComponent } from './reminder-settings/pause-reminders/paudeclarations: [NotificationsSettingsPageComponent,NotificationSettingInlineCreateComponent,- NotificationsSettingsToolbarComponent,NotificationSettingsTableComponent,ReminderSettingsPageComponent,ReminderSettingsDailyTimeComponent,diff --git a/modules/avatars/app/views/avatars/my/avatar.html.erb b/modules/avatars/app/views/avatars/my/avatar.html.erbindex 8fb505e4eea..9953e63a5a7 100644--- a/modules/avatars/app/views/avatars/my/avatar.html.erb+++ b/modules/avatars/app/views/avatars/my/avatar.html.erb@@ -1,8 +1,12 @@-<% breadcrumb_paths(t(:label_my_account), t(:button_change_avatar)) %>--<%= toolbar title: t(:button_change_avatar) %>-<% html_title t(:label_my_account), t(:button_change_avatar) %>+<% html_title t(:label_my_account), t(:label_avatar) %>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t(:label_avatar) }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t(:label_avatar)])+ end+%><% @manager = ::OpenProject::Avatars::AvatarManager %><% @target_avatar_path = edit_my_avatar_path %>diff --git a/modules/avatars/config/locales/en.yml b/modules/avatars/config/locales/en.ymlindex 780d08d4ccf..8754b38c8ba 100644--- a/modules/avatars/config/locales/en.yml+++ b/modules/avatars/config/locales/en.yml@@ -13,7 +13,6 @@ en:message_avatar_uploaded: "Avatar changed successfully."error_image_upload: "Error saving the image."error_image_size: "The image is too large."- button_change_avatar: "Change avatar"are_you_sure_delete_avatar: "Are you sure you want to delete your avatar?"avatar_deleted: "Avatar deleted successfully."unable_to_delete_avatar: "Avatar could not be deleted."diff --git a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rbindex ce1bb3df402..a9d2165f14d 100644--- a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb+++ b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb@@ -28,16 +28,6 @@ module ::TwoFactorAuthenticationfalseend- def inline_create_link- if self_table?- link_to({ controller: target_controller, action: :new },- class: "budget-add-row wp-inline-create--add-link",- title: I18n.t("two_factor_authentication.devices.add_new")) do- helpers.op_icon("icon icon-add")- end- end- end-delegate :enforced?, to: :strategy_managerdef strategy_managerdiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rbindex d4fe3153116..7ea36f5f9e4 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb@@ -18,7 +18,6 @@ module ::TwoFactorAuthenticationif params[:type]@device_type = params[:type].to_sym@device = new_device_type! @device_type-render "two_factor_authentication/two_factor_devices/new"else@available_devices = available_devicesdiff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rbindex 55e72a3cd47..37210741f3e 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb@@ -35,6 +35,7 @@ module ::TwoFactorAuthentication@two_factor_devices = @user.otp_devices.reload@has_remember_token_for_user = any_remember_token_present?(current_user)@remember_token = get_2fa_remember_token(current_user)+ @available_devices = available_devicesend##diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/my/backup_codes/show.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/my/backup_codes/show.html.erbindex 216f4679126..aa8b86c6c71 100644--- a/modules/two_factor_authentication/app/views/two_factor_authentication/my/backup_codes/show.html.erb+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/my/backup_codes/show.html.erb@@ -1,11 +1,13 @@<% html_title(t(:label_my_account), t('two_factor_authentication.backup_codes.plural')) -%>-<h1>- <%= t('two_factor_authentication.backup_codes.plural') %>- <small>- <%= t('two_factor_authentication.backup_codes.your_codes', login: current_user.login, app_name: Setting.app_title) %>- </small>-</h1>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t('two_factor_authentication.backup_codes.plural') }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ { href: my_2fa_devices_path , text: t('two_factor_authentication.label_two_factor_authentication') },+ t('two_factor_authentication.backup_codes.plural')])+ end+%><div class="op-toast show-when-print -warning"><div class="op-toast--content">diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erbindex 83c6f718ba6..2c3e110bf85 100644--- a/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/my/two_factor_devices/index.html.erb@@ -1,5 +1,37 @@<% html_title(t(:label_my_account), t('two_factor_authentication.label_two_factor_authentication')) -%>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t('two_factor_authentication.label_two_factor_authentication') }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ t('two_factor_authentication.label_two_factor_authentication')])+ end+%>++<%= render(Primer::OpenProject::SubHeader.new) do |subheader|+ subheader.with_action_component do+ render(Primer::Alpha::ActionMenu.new(anchor_align: :end)) do |menu|+ menu.with_show_button(scheme: :primary,+ test_selector: "two_factor_authentication_devices_button",+ aria: { label: t('two_factor_authentication.label_device') }) do |button|+ button.with_leading_visual_icon(icon: :plus)+ button.with_trailing_action_icon(icon: :"triangle-down")+ t('two_factor_authentication.label_device')+ end++ @available_devices.each do |key, device_class|+ menu.with_item(+ label: t("two_factor_authentication.devices.#{key}.title"),+ href: url_for(action: :new, type: key),+ test_selector: "two_factor_authentication_devices_#{key}"+ ) do |item|+ item.with_description.with_content(t("two_factor_authentication.devices.#{key}.description"))+ end+ end+ end+ end+end %>+<% if @has_remember_token_for_user %><section class="account--section" id="two_factor_authentication_remember_cookie"><div class="op-toast show-when-print -info">@@ -25,19 +57,6 @@</section><% end %>-<% breadcrumb_paths(t(:label_my_account), t('two_factor_authentication.label_two_factor_authentication')) -%>-<%= toolbar title: t('two_factor_authentication.label_two_factor_authentication') do %>- <li class="toolbar-item">- <%= link_to new_my_2fa_device_path,- { class: 'button -primary',- aria: {label: t('two_factor_authentication.label_device')},- title: t('two_factor_authentication.devices.add_new')} do %>- <%= op_icon('button--icon icon-add') %>- <span class="button--text"><%= t('two_factor_authentication.label_device') %></span>- <% end %>- </li>-<% end %>-<section class="account--section"><%= render partial: 'two_factor_status', locals: { device: @default_device }%></section>diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new.html.erbindex 5786e8c970b..3432a3c10db 100644--- a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new.html.erb+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new.html.erb@@ -1,7 +1,13 @@<% html_title(t(:label_my_account), t('two_factor_authentication.devices.add_new')) -%>-<% breadcrumb_paths link_to(t('two_factor_authentication.label_two_factor_authentication'), index_path),- t('two_factor_authentication.devices.add_new') -%>-<%= toolbar title: t('two_factor_authentication.devices.add_new') %>++<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title(test_selector: "two_factor_authentication_new_device_header_title") { t('two_factor_authentication.devices.add_new') }+ header.with_breadcrumbs([{ href: my_account_path, text: t(:label_my_account) },+ { href: my_2fa_devices_path , text: t('two_factor_authentication.label_two_factor_authentication') },+ I18n.t("menus.breadcrumb.nested_element", section_header: t("two_factor_authentication.devices.#{@device_type}.title"), title: t("two_factor_authentication.devices.add_new")).html_safe], selected_item_font_weight: :normal)+ end+%><%= labelled_tabular_form_for @device,url: { action: :register },html: { class: nil, autocomplete: 'off', data: {diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erbindex 0251cffe860..64dc167e2c3 100644--- a/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/two_factor_devices/new_type.html.erb@@ -1,20 +1,24 @@-<% html_title(t(:label_my_account), t('two_factor_authentication.devices.add_new')) -%>-<% breadcrumb_paths link_to(t('two_factor_authentication.label_two_factor_authentication'), index_path),- t('two_factor_authentication.devices.add_new') -%>+<% html_title(t(:button_login), t('two_factor_authentication.devices.add_new')) -%>+<%=+ render(Primer::OpenProject::PageHeader.new) do |header|+ header.with_title { t('two_factor_authentication.devices.add_new') }+ header.with_breadcrumbs([{ href: signin_path, text: t(:button_login) },+ t('two_factor_authentication.devices.add_new')])+ end+%><%= toolbar title: t('two_factor_authentication.devices.add_new') %><div class="mobile-otp-new-devices"><% @available_devices.each do |key, device_class| %>- <div class="mobile-otp-new-device mobile-otp-new-device-<%= key %>">- <h2><%= t("two_factor_authentication.devices.#{key}.title") %></h2>- <div class="mobile-otp-new-device--body">- <p><%= t("two_factor_authentication.devices.#{key}.description") %></p>+ <div class="mobile-otp-new-device mobile-otp-new-device-<%= key %>">+ <h2><%= t("two_factor_authentication.devices.#{key}.title") %></h2>+ <div class="mobile-otp-new-device--body">+ <p><%= t("two_factor_authentication.devices.#{key}.description") %></p>+ </div>+ <div class="mobile-otp-new-device--footer">+ <%= link_to t('two_factor_authentication.devices.register'), url_for(action: :new, type: key), class: 'button button--tiny' %>+ </div></div>- <div class="mobile-otp-new-device--footer">- <%= link_to t('two_factor_authentication.devices.register'), url_for(action: :new, type: key), class: 'button button--tiny' %>- </div>- </div><% end %></div>-diff --git a/modules/two_factor_authentication/config/locales/en.yml b/modules/two_factor_authentication/config/locales/en.ymlindex f1874d48fc7..14ec11425c6 100644--- a/modules/two_factor_authentication/config/locales/en.yml+++ b/modules/two_factor_authentication/config/locales/en.yml@@ -123,10 +123,10 @@ en:2fa_from_webauthn: Please provide the WebAuthn device <strong>%{device_name}</strong>. If it is USB based make sure to plug it in and touch it. Then click the sign in button.webauthn:title: "WebAuthn"- description: Use Web Authentication to register a FIDO2 device (like a YubiKey) or the secure enclave of your mobile device as a second factor.+ description: Register a FIDO2 device (like YubiKey) or the secure encalve of your mobile device.further_steps: After you have chosen a name, you can click the Continue button. Your browser will prompt you to present your WebAuthn device. When you have done so, you are done registering the device.totp:- title: "Use your app-based authenticator"+ title: "App-based authenticator"provisioning_uri: "Provisioning URI"secret_key: "Secret key"time_based: "Time based"@@ -139,14 +139,13 @@ en:text_cannot_scan: |If you can't scan the code, you can enter the entry manually using the following details:description: |- Register an application authenticator for use with OpenProject using the time-based one-time password authentication standard.- Common examples are Google Authenticator or Authy.+ Use a one-time code generated by an authenticator like Authy or Google Authenticator.sms:- title: "Use your mobile phone"+ title: "Mobile device"redacted_identifier: "Mobile device (%{redacted_number})"request_2fa_identifier: "%{redacted_identifier}, we sent you an authentication code via %{delivery_channel}"description: |- Register your mobile phone number for delivery of OpenProject one-time passwords.+ Receive 2FA code via a text message on your phone each time you log in.sns:delivery_failed: "SNS delivery failed:"message_bird:diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rbindex 5187f9b91cd..454362cc5a9 100644--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb@@ -22,13 +22,13 @@ RSpec.describe "My Account 2FA configuration", :js, with_settings: {expect(page).to have_css(".generic-table--empty-row", text: I18n.t("two_factor_authentication.devices.not_existing"))expect(page).to have_css(".on-off-status.-disabled")- # Visit inline create- find(".wp-inline-create--add-link").click- expect(page).to have_css("h2", text: I18n.t("two_factor_authentication.devices.add_new"))- expect(page).to have_current_path new_my_2fa_device_path-# Select SMS- find(".mobile-otp-new-device-sms .button").click+ menu_button = find_test_selector("two_factor_authentication_devices_button")+ menu_button.click+ wait_for_network_idle if using_cuprite?+ expect(page).to have_test_selector("two_factor_authentication_devices_sms")+ sms_menu_item = find_test_selector("two_factor_authentication_devices_sms")+ sms_menu_item.click# Try to save with invalid phone numberfill_in "device_phone_number", with: "invalid!"@@ -68,14 +68,17 @@ RSpec.describe "My Account 2FA configuration", :js, with_settings: {expect(page).to have_css(".on-off-status.-enabled")# Create another one as totp- # Visit create buttonvisit my_2fa_devices_path- find(".toolbar-item .button", text: "2FA device").click- expect(page).to have_css("h2", text: I18n.t("two_factor_authentication.devices.add_new"))- expect(page).to have_current_path new_my_2fa_device_path, ignore_query: true-+ menu_button = find_test_selector("two_factor_authentication_devices_button")+ menu_button.click+ wait_for_network_idle if using_cuprite?+ expect(page).to have_test_selector("two_factor_authentication_devices_totp")# Select totp- find(".mobile-otp-new-device-totp .button").click+ totp_menu_item = find_test_selector("two_factor_authentication_devices_totp")+ totp_menu_item.click+ expect(page).to have_test_selector("two_factor_authentication_new_device_header_title",+ text: I18n.t("two_factor_authentication.devices.add_new"))+ expect(page).to have_current_path new_my_2fa_device_path, ignore_query: true# Change identifierfill_in "device_identifier", with: "custom identifier"diff --git a/modules/two_factor_authentication/spec/features/password_change_spec.rb b/modules/two_factor_authentication/spec/features/password_change_spec.rbindex 414b7475957..ab911133082 100644--- a/modules/two_factor_authentication/spec/features/password_change_spec.rb+++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb@@ -31,7 +31,7 @@ RSpec.describe "Password change with OTP", :js, with_settings: {end# rubocop:enable RSpec/AnyInstance- expect(page).to have_css("h2", text: I18n.t(:button_change_password))+ expect(page).to have_test_selector("change_password_header_title", text: I18n.t(:button_change_password))within("#content") doSeleniumHubWaiter.waitfill_in("password", with: user_password)