From a3ea98a79fd1e008d79ce56f9b0c92edcf37be26 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 18 Jan 2020 18:40:48 +0000 Subject: [PATCH] Fix: You can now register an account when you haven't done it before --- src/Module/Settings/Delegation.php | 3 +++ view/templates/settings/delegation.tpl | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Module/Settings/Delegation.php b/src/Module/Settings/Delegation.php index d9ae60582..f0a335550 100644 --- a/src/Module/Settings/Delegation.php +++ b/src/Module/Settings/Delegation.php @@ -138,6 +138,8 @@ class Delegation extends BaseSettingsModule $parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')]; } + $is_child_user = !empty($user['parent-uid']); + $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/delegation.tpl'), [ '$form_security_token' => BaseModule::getFormSecurityToken('delegate'), '$account_header' => L10n::t('Additional Accounts'), @@ -147,6 +149,7 @@ class Delegation extends BaseSettingsModule '$parent_user' => $parent_user, '$parent_password' => $parent_password, '$parent_desc' => L10n::t('Parent users have total control about this account, including the account settings. Please double check whom you give this access.'), + '$is_child_user' => $is_child_user, '$submit' => L10n::t('Save Settings'), '$header' => L10n::t('Manage Accounts'), '$delegates_header' => L10n::t('Delegates'), diff --git a/view/templates/settings/delegation.tpl b/view/templates/settings/delegation.tpl index be8fdf606..b9f888cd6 100644 --- a/view/templates/settings/delegation.tpl +++ b/view/templates/settings/delegation.tpl @@ -1,5 +1,11 @@

{{$header}}

+{{if !$is_child_user}} +

{{$account_header}}

+
{{$account_desc}}
+{{$add_account}} +{{/if}} + {{if $parent_user}}

{{$parent_header}}

{{$parent_desc}}
@@ -11,10 +17,6 @@
-{{else}} -

{{$account_header}}

-
{{$account_desc}}
-{{$add_account}} {{/if}}

{{$delegates_header}}