Fix: You can now register an account when you haven't done it before

This commit is contained in:
Michael 2020-01-18 18:40:48 +00:00
parent c742c62f0a
commit a3ea98a79f
2 changed files with 9 additions and 4 deletions

View file

@ -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.')]; $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'), [ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('settings/delegation.tpl'), [
'$form_security_token' => BaseModule::getFormSecurityToken('delegate'), '$form_security_token' => BaseModule::getFormSecurityToken('delegate'),
'$account_header' => L10n::t('Additional Accounts'), '$account_header' => L10n::t('Additional Accounts'),
@ -147,6 +149,7 @@ class Delegation extends BaseSettingsModule
'$parent_user' => $parent_user, '$parent_user' => $parent_user,
'$parent_password' => $parent_password, '$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.'), '$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'), '$submit' => L10n::t('Save Settings'),
'$header' => L10n::t('Manage Accounts'), '$header' => L10n::t('Manage Accounts'),
'$delegates_header' => L10n::t('Delegates'), '$delegates_header' => L10n::t('Delegates'),

View file

@ -1,5 +1,11 @@
<h3>{{$header}}</h3> <h3>{{$header}}</h3>
{{if !$is_child_user}}
<h4>{{$account_header}}</h4>
<div id="add-account-desc" class="add-account-desc">{{$account_desc}}</div>
<a href='register'>{{$add_account}}</a>
{{/if}}
{{if $parent_user}} {{if $parent_user}}
<h4>{{$parent_header}}</h4> <h4>{{$parent_header}}</h4>
<div id="delegate-parent-desc" class="delegate-parent-desc">{{$parent_desc}}</div> <div id="delegate-parent-desc" class="delegate-parent-desc">{{$parent_desc}}</div>
@ -11,10 +17,6 @@
<div class="submit"><input type="submit" name="delegate" value="{{$submit}}"/></div> <div class="submit"><input type="submit" name="delegate" value="{{$submit}}"/></div>
</form> </form>
</div> </div>
{{else}}
<h4>{{$account_header}}</h4>
<div id="add-account-desc" class="add-account-desc">{{$account_desc}}</div>
<a href='register'>{{$add_account}}</a>
{{/if}} {{/if}}
<h4>{{$delegates_header}}</h4> <h4>{{$delegates_header}}</h4>