From 8256b9d6bdf6ee0e3bae295a8a47839f9457b2f1 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Fri, 3 Dec 2021 22:27:15 +0100 Subject: [PATCH] Hide oauth from profile and settings page if not configured / should be hidden --- includes/view/User_view.php | 4 +++ resources/assets/js/forms.js | 3 +++ resources/views/pages/settings/settings.twig | 10 ++++--- src/Controllers/SettingsController.php | 27 ++++++++++++++----- .../Controllers/SettingsControllerTest.php | 11 +++++++- 5 files changed, 44 insertions(+), 11 deletions(-) diff --git a/includes/view/User_view.php b/includes/view/User_view.php index 9d2df1ef..343327aa 100644 --- a/includes/view/User_view.php +++ b/includes/view/User_view.php @@ -870,6 +870,10 @@ function User_oauth_render(User $user) ); } + if (!$output) { + return ''; + } + return div('col-md-2', [ heading(__('OAuth'), 4), join('
', $output), diff --git a/resources/assets/js/forms.js b/resources/assets/js/forms.js index 774a4005..aecbec32 100644 --- a/resources/assets/js/forms.js +++ b/resources/assets/js/forms.js @@ -223,6 +223,9 @@ $(function () { $('#welcome-title').on('click', function () { $('.btn-group.btn-group .btn.d-none').removeClass('d-none'); }); + $('#settings-title').on('click', function () { + $('.user-settings .nav-item').removeClass('d-none'); + }); $('#oauth-settings-title').on('click', function () { $('table tr.d-none').removeClass('d-none'); }); diff --git a/resources/views/pages/settings/settings.twig b/resources/views/pages/settings/settings.twig index 1a9493c3..656022f4 100644 --- a/resources/views/pages/settings/settings.twig +++ b/resources/views/pages/settings/settings.twig @@ -6,7 +6,7 @@ {% block content %}
{% block container_title %} -

+

{{ __('settings.settings') }} {{ block('title') }}

@@ -14,10 +14,12 @@
-