Bugzilla – Attachment 191349 Details for
Bug 15349
Problem with email pattern check on forms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15349: Accept email addresses with display name in system preferences
Bug-15349-Accept-email-addresses-with-display-name.patch (text/plain), 3.36 KB, created by
Lari Taskula
on 2026-01-13 13:25:45 UTC
(
hide
)
Description:
Bug 15349: Accept email addresses with display name in system preferences
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2026-01-13 13:25:45 UTC
Size:
3.36 KB
patch
obsolete
>From 53db709eb9df1d82b7eab26cf59041e342172678 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Tue, 13 Jan 2026 15:15:34 +0200 >Subject: [PATCH] Bug 15349: Accept email addresses with display name in system > preferences > >To test: >1. Before applying this patch, navigate to system preferences >2. Search for preference KohaAdminEmailAddress >3. Enter anything that is not in the format of valid "email@address.com" >4. Observe error "Please enter a valid email address." >5. Apply patch >6. Enter anything that is not in the format of valid "email@address.com" > and not in the format of "display name <email@address.com>" >7. Observe error "Please enter a valid email address (display name allowed)." >8. Enter email@address.com >9. Save all Administration preferences >10. Observe no errors >11. Enter Display Name <email@address.com> >12. Save all Administration preferences >13. Observe no errors >--- > .../en/modules/admin/preferences/admin.pref | 2 +- > .../prog/js/pages/preferences.js | 22 +++++++++++++++++++ > 2 files changed, 23 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >index eac9b14907b..51b13021728 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref >@@ -4,7 +4,7 @@ Administration: > - > - "Email address for the administrator of Koha: " > - pref: KohaAdminEmailAddress >- class: email >+ class: email-with-display-name > - "(This is the default From: address for emails unless there is one for the particular library, and is referred to when an internal error occurs.)" > - > - "Email address to be set as the replyto in emails: " >diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >index bbe128f2491..f23332c4053 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js >@@ -365,12 +365,34 @@ $(".prefs-tab form").each(function () { > }); > }); > >+jQuery.validator.addMethod( >+ "email_with_display_name", >+ function (value, element) { >+ // Regex source >+ // https://web.archive.org/web/20251229171626/https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/email#basic_validation >+ // modified to accept "Display Name <user@host>" >+ return ( >+ this.optional(element) || >+ /^(?:\w+\s+<[\w.!#$%&'*+/=?^`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*>)$|^(?:[\w.!#$%&'*+/=?^`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)$/.test( >+ value >+ ) >+ ); >+ }, >+ __("Please enter a valid email address (display name allowed).") >+); >+ > $(".preference-email").each(function () { > $(this).rules("add", { > email: true, > }); > }); > >+$(".preference-email-with-display-name").each(function () { >+ $(this).rules("add", { >+ email_with_display_name: true, >+ }); >+}); >+ > $(".modalselect").on("click", function () { > var datasource = $(this).data("source"); > var exclusions = $(this).data("exclusions").split("|"); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15349
:
191349
|
191366
|
191373