From 03c44b399240a0c542aee03ec974c66ffd661865 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Wed, 18 Oct 2023 17:53:58 +0100 Subject: [PATCH] My Account: Extracted/tweaked profile text, removed old index --- app/Api/ApiDocsController.php | 2 + .../Controllers/UserAccountController.php | 12 ++-- lang/en/common.php | 1 + lang/en/preferences.php | 9 ++- resources/views/users/account/index.blade.php | 62 ------------------- .../views/users/account/profile.blade.php | 35 +++-------- routes/web.php | 2 +- 7 files changed, 26 insertions(+), 97 deletions(-) delete mode 100644 resources/views/users/account/index.blade.php diff --git a/app/Api/ApiDocsController.php b/app/Api/ApiDocsController.php index 382ec15eb..d88dba3bc 100644 --- a/app/Api/ApiDocsController.php +++ b/app/Api/ApiDocsController.php @@ -31,6 +31,8 @@ class ApiDocsController extends ApiController /** * Redirect to the API docs page. + * Required as a controller method, instead of the Route::redirect helper, + * to ensure the URL is generated correctly. */ public function redirect() { diff --git a/app/Users/Controllers/UserAccountController.php b/app/Users/Controllers/UserAccountController.php index 83e942b04..bdd923d6d 100644 --- a/app/Users/Controllers/UserAccountController.php +++ b/app/Users/Controllers/UserAccountController.php @@ -26,15 +26,13 @@ class UserAccountController extends Controller } /** - * Show the overview for user preferences. + * Redirect the root my-account path to the main/first category. + * Required as a controller method, instead of the Route::redirect helper, + * to ensure the URL is generated correctly. */ - public function index() + public function redirect() { - $mfaMethods = user()->mfaValues->groupBy('method'); - - return view('users.account.index', [ - 'mfaMethods' => $mfaMethods, - ]); + return redirect('/my-account/profile'); } /** diff --git a/lang/en/common.php b/lang/en/common.php index 47b74d5b6..27037babe 100644 --- a/lang/en/common.php +++ b/lang/en/common.php @@ -52,6 +52,7 @@ return [ 'filter_clear' => 'Clear Filter', 'download' => 'Download', 'open_in_tab' => 'Open in Tab', + 'open' => 'Open', // Sort Options 'sort_options' => 'Sort Options', diff --git a/lang/en/preferences.php b/lang/en/preferences.php index 7774db570..042612662 100644 --- a/lang/en/preferences.php +++ b/lang/en/preferences.php @@ -35,5 +35,12 @@ return [ 'auth_change_password_success' => 'Password has been updated!', 'profile' => 'Profile Details', - 'profile_overview_desc' => 'Manage your user profile details including preferred language and authentication options.', + 'profile_desc' => 'Manage the details of your account which represents you to other users, in addition to details that are used for communication and system personalisation.', + 'profile_view_public' => 'View Public Profile', + 'profile_name_desc' => 'Configure your display name which will be visible to other users in the system through the activity you perform, and content you own.', + 'profile_email_desc' => 'This email will be used for notifications and, depending on active system authentication, system access.', + 'profile_email_no_permission' => 'Unfortunately you don\'t have permission to change your email address. If you want to change this, you\'d need to ask an administrator to change this for you.', + 'profile_avatar_desc' => 'Select an image which will be used to represent yourself to others in the system. Ideally this image should be square and about 256px in width and height.', + 'profile_admin_options' => 'Administrator Options', + 'profile_admin_options_desc' => 'Additional administrator-level options, like those to manage role assignments, can be found for your user account in the "Settings > Users" area of the application.', ]; diff --git a/resources/views/users/account/index.blade.php b/resources/views/users/account/index.blade.php deleted file mode 100644 index 11a5bc9c9..000000000 --- a/resources/views/users/account/index.blade.php +++ /dev/null @@ -1,62 +0,0 @@ -@extends('layouts.simple') - -@section('body') -
- -
-
-

{{ trans('preferences.shortcuts_interface') }}

-

{{ trans('preferences.shortcuts_overview_desc') }}

-
- -
- - @if(!user()->isGuest() && userCan('receive-notifications')) -
-
-

{{ trans('preferences.notifications') }}

-

{{ trans('preferences.notifications_desc') }}

-
- -
- @endif - - @if(!user()->isGuest()) -
-
-

{{ trans('settings.users_edit_profile') }}

-

{{ trans('preferences.profile_overview_desc') }}

-
- -
- @endif - - @if(!user()->isGuest()) -
-
-

{{ trans('settings.users_mfa') }}

-

{{ trans('settings.users_mfa_desc') }}

-

- @if ($mfaMethods->count() > 0) - @icon('check-circle') - @else - @icon('cancel') - @endif - {{ trans_choice('settings.users_mfa_x_methods', $mfaMethods->count()) }} -

-
- -
- @endif - -
-@stop diff --git a/resources/views/users/account/profile.blade.php b/resources/views/users/account/profile.blade.php index 4256df109..785d562e4 100644 --- a/resources/views/users/account/profile.blade.php +++ b/resources/views/users/account/profile.blade.php @@ -10,24 +10,18 @@

{{ trans('preferences.profile') }}

- View Public Profile + {{ trans('preferences.profile_view_public') }}
-

- Manage the details of your account that represent you to other users, in addition to - details that are used for communication and system personalisation. -

+

{{ trans('preferences.profile_desc') }}

-

- Configure your display name which will be visible to other users in the system - within the activity you perform, and content you own. -

+

{{ trans('preferences.profile_name_desc') }}

@include('form.text', ['name' => 'name']) @@ -38,19 +32,14 @@
-

- This email will be used for notifications and, depending on active system authentication, system access. -

+

{{ trans('preferences.profile_email_desc') }}

@include('form.text', ['name' => 'email', 'disabled' => !userCan('users-manage')])
@if(!userCan('users-manage')) -

- Unfortunately you don't have permission to change your email address. - If you want to change this, you'd need to ask an administrator to change this for you. -

+

{{ trans('preferences.profile_email_no_permission') }}

@endif
@@ -58,10 +47,7 @@
-

- Select an image which will be used to represent yourself to others - in the system. Ideally this image should be square and about 256px in width and height. -

+

{{ trans('preferences.profile_avatar_desc') }}

@include('form.image-picker', [ @@ -92,14 +78,11 @@
-

Administrator Options

-

- Additional administrator-level options, like role options, can be found for your user account in the - "Settings > Users" area of the application. -

+

{{ trans('preferences.profile_admin_options') }}

+

{{ trans('preferences.profile_admin_options_desc') }}

diff --git a/routes/web.php b/routes/web.php index 3f1bcc07e..16c3c3d6a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -233,7 +233,7 @@ Route::middleware('auth')->group(function () { Route::delete('/settings/users/{id}', [UserControllers\UserController::class, 'destroy']); // User Account - Route::get('/my-account', [UserControllers\UserAccountController::class, 'index']); + Route::get('/my-account', [UserControllers\UserAccountController::class, 'redirect']); Route::get('/my-account/profile', [UserControllers\UserAccountController::class, 'showProfile']); Route::put('/my-account/profile', [UserControllers\UserAccountController::class, 'updateProfile']); Route::get('/my-account/shortcuts', [UserControllers\UserAccountController::class, 'showShortcuts']);