From: Tim Düsterhus Date: Wed, 18 Nov 2020 14:22:45 +0000 (+0100) Subject: Use multifactor prefix for formbuilder templates related to MFA X-Git-Tag: 5.4.0_Alpha_1~555^2~46 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1e08b49f1c61ecb81a15f1d163d7322043a0512e;p=GitHub%2FWoltLab%2FWCF.git Use multifactor prefix for formbuilder templates related to MFA --- diff --git a/com.woltlab.wcf/templates/__backupCodeField.tpl b/com.woltlab.wcf/templates/__backupCodeField.tpl deleted file mode 100644 index d76256140e..0000000000 --- a/com.woltlab.wcf/templates/__backupCodeField.tpl +++ /dev/null @@ -1,17 +0,0 @@ -getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/if}{* - *}{if $field->isAutofocused()} autofocus{/if}{* - *}{if $field->isRequired()} required{/if}{* - *}{if $field->isImmutable()} disabled{/if}{* - *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* - *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* - *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* - *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* -*}> diff --git a/com.woltlab.wcf/templates/__emailCodeField.tpl b/com.woltlab.wcf/templates/__emailCodeField.tpl deleted file mode 100644 index 331481b5b7..0000000000 --- a/com.woltlab.wcf/templates/__emailCodeField.tpl +++ /dev/null @@ -1,17 +0,0 @@ -getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* - *}pattern="[0-9]*" {* - *}inputmode="numeric"{* - *}{if $field->isAutofocused()} autofocus{/if}{* - *}{if $field->isRequired()} required{/if}{* - *}{if $field->isImmutable()} disabled{/if}{* - *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* - *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* - *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* - *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* -*}> diff --git a/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl b/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl new file mode 100644 index 0000000000..d76256140e --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorBackupCodeField.tpl @@ -0,0 +1,17 @@ +getChunks() && $field->getChunkLength()} size="{$field->getChunks() - 1 + $field->getChunks() * $field->getChunkLength()}"{/if}{* + *}{if $field->isAutofocused()} autofocus{/if}{* + *}{if $field->isRequired()} required{/if}{* + *}{if $field->isImmutable()} disabled{/if}{* + *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* + *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* + *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* + *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* +*}> diff --git a/com.woltlab.wcf/templates/__multifactorEmailCodeField.tpl b/com.woltlab.wcf/templates/__multifactorEmailCodeField.tpl new file mode 100644 index 0000000000..331481b5b7 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorEmailCodeField.tpl @@ -0,0 +1,17 @@ +getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* + *}pattern="[0-9]*" {* + *}inputmode="numeric"{* + *}{if $field->isAutofocused()} autofocus{/if}{* + *}{if $field->isRequired()} required{/if}{* + *}{if $field->isImmutable()} disabled{/if}{* + *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* + *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* + *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* + *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* +*}> diff --git a/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl b/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl new file mode 100644 index 0000000000..9b46101f55 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpCodeField.tpl @@ -0,0 +1,17 @@ +getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* + *}pattern="[0-9]*" {* + *}inputmode="numeric"{* + *}{if $field->isAutofocused()} autofocus{/if}{* + *}{if $field->isRequired()} required{/if}{* + *}{if $field->isImmutable()} disabled{/if}{* + *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* + *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* + *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* + *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* +*}> diff --git a/com.woltlab.wcf/templates/__multifactorTotpDeviceNoDeleteButton.tpl b/com.woltlab.wcf/templates/__multifactorTotpDeviceNoDeleteButton.tpl new file mode 100644 index 0000000000..1d4047c157 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpDeviceNoDeleteButton.tpl @@ -0,0 +1,4 @@ + + diff --git a/com.woltlab.wcf/templates/__multifactorTotpDeviceNode.tpl b/com.woltlab.wcf/templates/__multifactorTotpDeviceNode.tpl new file mode 100644 index 0000000000..a96b0f3009 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpDeviceNode.tpl @@ -0,0 +1,13 @@ + + + {$device[deviceName]} + {$device[createTime]|plainTime} + {if $device[useTime]}{$device[useTime]|plainTime}{else}–{/if} + + {foreach from=$container item='child'} + {if $child->isAvailable()} + {@$child->getHtml()} + {/if} + {/foreach} + + diff --git a/com.woltlab.wcf/templates/__multifactorTotpDevicesContainer.tpl b/com.woltlab.wcf/templates/__multifactorTotpDevicesContainer.tpl new file mode 100644 index 0000000000..a7238b297d --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpDevicesContainer.tpl @@ -0,0 +1,43 @@ +
getClasses()|empty} class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{* + *}{if !$container->checkDependencies()} style="display: none;"{/if}{* +*}> + {if $container->getLabel() !== null} + {if $container->getDescription() !== null} +
+

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

+

{@$container->getDescription()}

+
+ {else} +

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

+ {/if} + {/if} + + + + + + + + + + + + + {foreach from=$container item='child'} + {if $child->isAvailable()} + {@$child->getHtml()} + {/if} + {/foreach} + +
{lang}wcf.user.security.multifactor.totp.deviceName{/lang}{lang}wcf.user.security.multifactor.totp.createTime{/lang}{lang}wcf.user.security.multifactor.totp.useTime{/lang}
+
+ +{include file='__formContainerDependencies'} + + diff --git a/com.woltlab.wcf/templates/__multifactorTotpNewDeviceContainer.tpl b/com.woltlab.wcf/templates/__multifactorTotpNewDeviceContainer.tpl new file mode 100644 index 0000000000..19b8887a12 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpNewDeviceContainer.tpl @@ -0,0 +1,46 @@ +
getClasses()|empty} class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* + *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{* + *}{if !$container->checkDependencies()} style="display: none;"{/if}{* +*}> + {if $container->getLabel() !== null} + {if $container->getDescription() !== null} +
+

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

+

{@$container->getDescription()}

+
+ {else} +

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

+ {/if} + {/if} + + {lang}wcf.user.security.multifactor.totp.newDevice.description{/lang} + +
+ {if $container->getNodeById('secret')->isAvailable()} + {@$container->getNodeById('secret')->getFieldHtml()} + {/if} + +
+ {foreach from=$container item='child'} + {if $child->getId() !== 'secret' && $child->getId() !== 'submitButton' && $child->isAvailable()} + {@$child->getHtml()} + {/if} + {/foreach} + + {if $container->getNodeById('submitButton')->isAvailable()} +
+ {@$container->getNodeById('submitButton')->getHtml()} +
+ {/if} +
+
+
+ +{include file='__formContainerDependencies'} + + diff --git a/com.woltlab.wcf/templates/__multifactorTotpSecretField.tpl b/com.woltlab.wcf/templates/__multifactorTotpSecretField.tpl new file mode 100644 index 0000000000..fc32f52215 --- /dev/null +++ b/com.woltlab.wcf/templates/__multifactorTotpSecretField.tpl @@ -0,0 +1,15 @@ +
+ +
+ {$field->getEncodedValue()} + + +
diff --git a/com.woltlab.wcf/templates/__totpCodeField.tpl b/com.woltlab.wcf/templates/__totpCodeField.tpl deleted file mode 100644 index 9b46101f55..0000000000 --- a/com.woltlab.wcf/templates/__totpCodeField.tpl +++ /dev/null @@ -1,17 +0,0 @@ -getMaximumLength() !== null}size="{$field->getMaximumLength()}" {/if}{* - *}pattern="[0-9]*" {* - *}inputmode="numeric"{* - *}{if $field->isAutofocused()} autofocus{/if}{* - *}{if $field->isRequired()} required{/if}{* - *}{if $field->isImmutable()} disabled{/if}{* - *}{if $field->getMinimumLength() !== null} minlength="{$field->getMinimumLength()}"{/if}{* - *}{if $field->getMaximumLength() !== null} maxlength="{$field->getMaximumLength()}"{/if}{* - *}{if $field->getPlaceholder() !== null} placeholder="{$field->getPlaceholder()}"{/if}{* - *}{if $field->getDocument()->isAjax()} data-dialog-submit-on-enter="true"{/if}{* -*}> diff --git a/com.woltlab.wcf/templates/__totpDeviceNoDeleteButton.tpl b/com.woltlab.wcf/templates/__totpDeviceNoDeleteButton.tpl deleted file mode 100644 index 1d4047c157..0000000000 --- a/com.woltlab.wcf/templates/__totpDeviceNoDeleteButton.tpl +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/com.woltlab.wcf/templates/__totpDeviceNode.tpl b/com.woltlab.wcf/templates/__totpDeviceNode.tpl deleted file mode 100644 index a96b0f3009..0000000000 --- a/com.woltlab.wcf/templates/__totpDeviceNode.tpl +++ /dev/null @@ -1,13 +0,0 @@ - - - {$device[deviceName]} - {$device[createTime]|plainTime} - {if $device[useTime]}{$device[useTime]|plainTime}{else}–{/if} - - {foreach from=$container item='child'} - {if $child->isAvailable()} - {@$child->getHtml()} - {/if} - {/foreach} - - diff --git a/com.woltlab.wcf/templates/__totpDevicesContainer.tpl b/com.woltlab.wcf/templates/__totpDevicesContainer.tpl deleted file mode 100644 index a7238b297d..0000000000 --- a/com.woltlab.wcf/templates/__totpDevicesContainer.tpl +++ /dev/null @@ -1,43 +0,0 @@ -
getClasses()|empty} class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* - *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{* - *}{if !$container->checkDependencies()} style="display: none;"{/if}{* -*}> - {if $container->getLabel() !== null} - {if $container->getDescription() !== null} -
-

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

-

{@$container->getDescription()}

-
- {else} -

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

- {/if} - {/if} - - - - - - - - - - - - - {foreach from=$container item='child'} - {if $child->isAvailable()} - {@$child->getHtml()} - {/if} - {/foreach} - -
{lang}wcf.user.security.multifactor.totp.deviceName{/lang}{lang}wcf.user.security.multifactor.totp.createTime{/lang}{lang}wcf.user.security.multifactor.totp.useTime{/lang}
-
- -{include file='__formContainerDependencies'} - - diff --git a/com.woltlab.wcf/templates/__totpNewDeviceContainer.tpl b/com.woltlab.wcf/templates/__totpNewDeviceContainer.tpl deleted file mode 100644 index 19b8887a12..0000000000 --- a/com.woltlab.wcf/templates/__totpNewDeviceContainer.tpl +++ /dev/null @@ -1,46 +0,0 @@ -
getClasses()|empty} class="{implode from=$container->getClasses() item='class' glue=' '}{$class}{/implode}"{/if}{* - *}{foreach from=$container->getAttributes() key='attributeName' item='attributeValue'} {$attributeName}="{$attributeValue}"{/foreach}{* - *}{if !$container->checkDependencies()} style="display: none;"{/if}{* -*}> - {if $container->getLabel() !== null} - {if $container->getDescription() !== null} -
-

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

-

{@$container->getDescription()}

-
- {else} -

{@$container->getLabel()}{if $container->markAsRequired()} *{/if}

- {/if} - {/if} - - {lang}wcf.user.security.multifactor.totp.newDevice.description{/lang} - -
- {if $container->getNodeById('secret')->isAvailable()} - {@$container->getNodeById('secret')->getFieldHtml()} - {/if} - -
- {foreach from=$container item='child'} - {if $child->getId() !== 'secret' && $child->getId() !== 'submitButton' && $child->isAvailable()} - {@$child->getHtml()} - {/if} - {/foreach} - - {if $container->getNodeById('submitButton')->isAvailable()} -
- {@$container->getNodeById('submitButton')->getHtml()} -
- {/if} -
-
-
- -{include file='__formContainerDependencies'} - - diff --git a/com.woltlab.wcf/templates/__totpSecretField.tpl b/com.woltlab.wcf/templates/__totpSecretField.tpl deleted file mode 100644 index fc32f52215..0000000000 --- a/com.woltlab.wcf/templates/__totpSecretField.tpl +++ /dev/null @@ -1,15 +0,0 @@ -
- -
- {$field->getEncodedValue()} - - -
diff --git a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php index 1344fd257a..6edcddd6f0 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php @@ -132,7 +132,7 @@ class TotpMultifactorMethod implements IMultifactorMethod { } else { $button = new class extends FormButton { - protected $templateName = '__totpDeviceNoDeleteButton'; + protected $templateName = '__multifactorTotpDeviceNoDeleteButton'; }; $button->id('no-delete-'.$row['deviceID']) ->label('wcf.global.button.delete'); diff --git a/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php index 51b09aca71..62617bf9fa 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/backup/CodeFormField.class.php @@ -30,7 +30,7 @@ class CodeFormField extends TextFormField { /** * @inheritDoc */ - protected $templateName = '__backupCodeField'; + protected $templateName = '__multifactorBackupCodeField'; public function __construct() { $this->chunks(BackupMultifactorMethod::CHUNKS); diff --git a/wcfsetup/install/files/lib/system/user/multifactor/email/CodeFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/email/CodeFormField.class.php index 3e1b384b42..0e288b06b5 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/email/CodeFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/email/CodeFormField.class.php @@ -20,7 +20,7 @@ class CodeFormField extends TextFormField { /** * @inheritDoc */ - protected $templateName = '__emailCodeField'; + protected $templateName = '__multifactorEmailCodeField'; public function __construct() { $this->minimumLength(EmailMultifactorMethod::LENGTH); diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php index ddc9528ca5..35aed91541 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/CodeFormField.class.php @@ -19,7 +19,7 @@ class CodeFormField extends TextFormField { /** * @inheritDoc */ - protected $templateName = '__totpCodeField'; + protected $templateName = '__multifactorTotpCodeField'; /** * @var ?int diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/DeviceNode.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/DeviceNode.class.php index 82027d21bb..8fbb393530 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/DeviceNode.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/DeviceNode.class.php @@ -31,7 +31,7 @@ class DeviceNode implements IFormChildNode, IFormParentNode { /** * @inheritDoc */ - protected $templateName = '__totpDeviceNode'; + protected $templateName = '__multifactorTotpDeviceNode'; /** * @inheritDoc diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/DevicesContainer.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/DevicesContainer.class.php index 3692f2eb6a..117b0519df 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/DevicesContainer.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/DevicesContainer.class.php @@ -25,7 +25,7 @@ class DevicesContainer extends FormContainer { /** * @inheritDoc */ - protected $templateName = '__totpDevicesContainer'; + protected $templateName = '__multifacatorTotpDevicesContainer'; /** * @inheritDoc diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/NewDeviceContainer.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/NewDeviceContainer.class.php index b3cf109a02..34434d27ce 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/NewDeviceContainer.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/NewDeviceContainer.class.php @@ -18,7 +18,7 @@ class NewDeviceContainer extends FormContainer { /** * @inheritDoc */ - protected $templateName = '__totpNewDeviceContainer'; + protected $templateName = '__multifactorTotpNewDeviceContainer'; /** * @inheritDoc diff --git a/wcfsetup/install/files/lib/system/user/multifactor/totp/SecretFormField.class.php b/wcfsetup/install/files/lib/system/user/multifactor/totp/SecretFormField.class.php index c935f50698..30813842b0 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/totp/SecretFormField.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/totp/SecretFormField.class.php @@ -20,7 +20,7 @@ class SecretFormField extends AbstractFormField { /** * @inheritDoc */ - protected $templateName = '__totpSecretField'; + protected $templateName = '__multifactorTotpSecretField'; public function __construct() { $this->value(Totp::generateSecret());