From e6da6668852b3a9d54b3f781a69e4aa536b24f2e Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Thu, 5 Dec 2019 20:19:25 +0100 Subject: [PATCH 1/5] Make Two Factor Field numeric --- src/Module/TwoFactor/Verify.php | 2 +- view/templates/field_input.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Module/TwoFactor/Verify.php b/src/Module/TwoFactor/Verify.php index f6f040f5a..958585925 100644 --- a/src/Module/TwoFactor/Verify.php +++ b/src/Module/TwoFactor/Verify.php @@ -64,7 +64,7 @@ class Verify extends BaseModule '$errors_label' => L10n::tt('Error', 'Errors', count(self::$errors)), '$errors' => self::$errors, '$recovery_message' => L10n::t('Don’t have your phone? Enter a two-factor recovery code', '2fa/recovery'), - '$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"'], + '$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'int'], '$verify_label' => L10n::t('Verify code and complete login'), ]); } diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index 399cf0c43..b0462e9f2 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -1,7 +1,7 @@
- + {{if $field.3}} {{$field.3 nofilter}} {{/if}} From da3e293e9157d51b126bb01e2193d80eb3a216e2 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Thu, 5 Dec 2019 20:47:21 +0100 Subject: [PATCH 2/5] Adding doc for new field-type --- doc/smarty3-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index f174f2164..abb1ed563 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -89,7 +89,7 @@ Field parameter: 3. Help text for the input box, 4. if set to "required" modern browser will check that this input box is filled when submitting the form, 5. if set to "autofocus" modern browser will put the cursur into this box once the page is loaded, -6. if set to "email" or "url" modern browser will check that the filled in value corresponds to an email address or URL. +6. if set to "email", "url" or "int" modern browser will check that the filled in value corresponds to an email address, URL or numeric. ### field_intcheckbox.tpl From 47505aceec819575788556bb8b05146995b2f2a4 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Thu, 5 Dec 2019 21:13:49 +0100 Subject: [PATCH 3/5] double quoted field & use number --- view/templates/field_input.tpl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index b0462e9f2..4815302ae 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -1,8 +1,8 @@ -
- - +
+ + {{if $field.3}} - {{$field.3 nofilter}} + {{$field.3 nofilter}} {{/if}}
From c28f1fec519de3728fc8b9497cc6dac3f22f33c1 Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Thu, 5 Dec 2019 21:42:33 +0100 Subject: [PATCH 4/5] General usage of type in input fields --- doc/smarty3-templates.md | 4 ++-- src/Module/TwoFactor/Verify.php | 2 +- view/templates/field_input.tpl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index abb1ed563..6e98d0865 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -80,7 +80,7 @@ Field parameter: ### field_input.tpl -A single line input field for textual input. +A single line input field for any type of input. Field parameter: 0. Name of the field, @@ -89,7 +89,7 @@ Field parameter: 3. Help text for the input box, 4. if set to "required" modern browser will check that this input box is filled when submitting the form, 5. if set to "autofocus" modern browser will put the cursur into this box once the page is loaded, -6. if set to "email", "url" or "int" modern browser will check that the filled in value corresponds to an email address, URL or numeric. +6. if set, it will be used for the input type, default is `text` (possible types: https://www.w3schools.com/html/html_form_input_types.asp). ### field_intcheckbox.tpl diff --git a/src/Module/TwoFactor/Verify.php b/src/Module/TwoFactor/Verify.php index 958585925..27001683e 100644 --- a/src/Module/TwoFactor/Verify.php +++ b/src/Module/TwoFactor/Verify.php @@ -64,7 +64,7 @@ class Verify extends BaseModule '$errors_label' => L10n::tt('Error', 'Errors', count(self::$errors)), '$errors' => self::$errors, '$recovery_message' => L10n::t('Don’t have your phone? Enter a two-factor recovery code', '2fa/recovery'), - '$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'int'], + '$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'number'], '$verify_label' => L10n::t('Verify code and complete login'), ]); } diff --git a/view/templates/field_input.tpl b/view/templates/field_input.tpl index 4815302ae..956c6259c 100644 --- a/view/templates/field_input.tpl +++ b/view/templates/field_input.tpl @@ -1,7 +1,7 @@
- + {{if $field.3}} {{$field.3 nofilter}} {{/if}} From 144d4d9cf563796278f6060ac4f7cb13a21ba4ae Mon Sep 17 00:00:00 2001 From: nupplaPhil Date: Thu, 5 Dec 2019 22:10:04 +0100 Subject: [PATCH 5/5] add non-leecher link --- doc/smarty3-templates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/smarty3-templates.md b/doc/smarty3-templates.md index 6e98d0865..1fadcb221 100644 --- a/doc/smarty3-templates.md +++ b/doc/smarty3-templates.md @@ -89,7 +89,7 @@ Field parameter: 3. Help text for the input box, 4. if set to "required" modern browser will check that this input box is filled when submitting the form, 5. if set to "autofocus" modern browser will put the cursur into this box once the page is loaded, -6. if set, it will be used for the input type, default is `text` (possible types: https://www.w3schools.com/html/html_form_input_types.asp). +6. if set, it will be used for the input type, default is `text` (possible types: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#%3Cinput%3E_types). ### field_intcheckbox.tpl