View | Details | Raw Unified | Return to bug 15349
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (-1 / +1 lines)
Lines 4-10 Administration: Link Here
4
        -
4
        -
5
            - "Email address for the administrator of Koha: "
5
            - "Email address for the administrator of Koha: "
6
            - pref: KohaAdminEmailAddress
6
            - pref: KohaAdminEmailAddress
7
              class: email
7
              class: email-with-display-name
8
            - "(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.)"
8
            - "(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.)"
9
        -
9
        -
10
            - "Email address to be set as the replyto in emails: "
10
            - "Email address to be set as the replyto in emails: "
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (+6 lines)
Lines 371-376 $(".preference-email").each(function () { Link Here
371
    });
371
    });
372
});
372
});
373
373
374
$(".preference-email-with-display-name").each(function () {
375
    $(this).rules("add", {
376
        email_with_display_name: true,
377
    });
378
});
379
374
$(".modalselect").on("click", function () {
380
$(".modalselect").on("click", function () {
375
    var datasource = $(this).data("source");
381
    var datasource = $(this).data("source");
376
    var exclusions = $(this).data("exclusions").split("|");
382
    var exclusions = $(this).data("exclusions").split("|");
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +19 lines)
Lines 188-193 $(document).ready(function () { Link Here
188
        decimal_rate: true,
188
        decimal_rate: true,
189
    });
189
    });
190
190
191
    jQuery.validator.addMethod(
192
        "email_with_display_name",
193
        function (value, element) {
194
            // https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
195
            let html5_email_regex =
196
                "[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*";
197
            let display_name_regex = "[^<>\x0A\x0D]+";
198
            let validation_regex = new RegExp(
199
                `^${display_name_regex}<${html5_email_regex}>\$|^${html5_email_regex}\$`
200
            );
201
            return this.optional(element) || validation_regex.test(value);
202
        },
203
        __("Please enter a valid email address (display name allowed).")
204
    );
205
206
    jQuery.validator.addClassRules("email_with_display_name", {
207
        email_with_display_name: true,
208
    });
209
191
    $("#logout").on("click", function () {
210
    $("#logout").on("click", function () {
192
        logOut();
211
        logOut();
193
    });
212
    });
194
- 

Return to bug 15349