Bug 27805

Summary: Use input type "email" for email preferences
Product: Koha Reporter: Owen Leonard <oleonard>
Component: System AdministrationAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: amitddng135, fridolin.somers, gmcharlt
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch modifies the global system preferences interface so that fields which ask for an email address have the correct HTML attribute type: email. This allows some basic email address validation by the browser and can enable different keyboard options on devices with onscreen keyboards.
Version(s) released in:
21.05.00
Circulation function:
Bug Depends on:    
Bug Blocks: 31376    
Attachments: Bug 27805: Use input type "email" for email preferences
Bug 27805: Use input type "email" for email preferences
Bug 27805: (follow-up) Update more instances
Bug 27805: Use input type "email" for email preferences
Bug 27805: (follow-up) Update more instances

Description Owen Leonard 2021-02-26 12:42:06 UTC
We already have "class: email" in the pref files, we should check for that value when generating the markup.
Comment 1 Owen Leonard 2021-03-04 14:53:20 UTC Comment hidden (obsolete)
Comment 2 Amit Gupta 2021-03-24 10:04:51 UTC Comment hidden (obsolete)
Comment 3 Katrin Fischer 2021-03-27 16:52:35 UTC
Hi Owen,

this works for most, but I found some we still need to set the email class for:

NoticeBcc  
ILLDefaultStaffEmail
PayPalUser
EmailSMSSendDriverFromAddress 

Could we deal with those in a follow-up please?
Comment 4 Owen Leonard 2021-03-29 12:00:24 UTC Comment hidden (obsolete)
Comment 5 Katrin Fischer 2021-04-03 14:14:20 UTC
Created attachment 119155 [details] [review]
Bug 27805: Use input type "email" for email preferences

This patch changes the way input fields are output in the system
preferences template for preferences which have an "email" class. The
input type will now be "email" instead of "text."

Email type inputs are "loosely" validated. Mozilla's documentation says
valid patterns are "username@domain or username@domain.tld," so Koha's
default "root@localhost" will still work.

The other advantage of an "email" type input is that it typically
triggers different keyboard options in mobile devices.

To test, apply the patch and go to Administration -> Global system
preferences.

- Search system preferences for "email."
- Test the email type preferences you find (e.g. KohaAdminEmailAddress,
  ReplytoDefault, SendAllEmailsTo), confirming that email
  addresses like username@domain or username@domain.tld work correctly.
- Confirm that any other value triggers a validation error.

Signed-off-by: Amit Gupta <amitddng135@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Katrin Fischer 2021-04-03 14:14:24 UTC
Created attachment 119156 [details] [review]
Bug 27805: (follow-up) Update more instances

This patch updates some preferences I missed in the first round:

- NoticeBcc
- ILLDefaultStaffEmail
- PayPalUser
- EmailSMSSendDriverFromAddress

I've also modified the preferences CSS so that fields with type "email"
are styled the same as fields with the "long" class to give more room
for email addresses.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 7 Jonathan Druart 2021-04-06 13:57:59 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 8 Fridolin Somers 2021-04-15 11:20:44 UTC
Enhancement not pushed to 20.11.x