LP1755625: Multiple emails in patron editor
Even though the HTML5 "email" input type allows multiple
addresses to be separated by commas there is nothing that
can be done to signal to Angular.js that this is ok; it
will only ever accept a single address. This patch forces
the type of the input tag to plain text so Angular will
rely on any supplied regex to verify the entry.
The ui.patron.edit.au.email.regex (Regex for email field on patron
registration) library setting can be used to control whether
one or multiple email addresses will be permitted on the
patron registration form.
To allow multiple addresses, that setting can be:
^(?:(?:\b[^@,\s]+@[^@,\s]+\.[^@.,\s]+\b)(?:,\s?(?!$)|$))*$
To allow only a single address, use:
^(?:\b[^@,\s]+@[^@,\s]+\.[^@.,\s]+\b)$
To test
-------
[1] In the web staff client, try to register a new patron, entering
multiple email addresseses in the email field separated by
commas.
[2] Note that the email field displays as invalid and the
record cannot be saved.
[3] Apply the patch and repeat step #1, This time, the email
field should accept multiple addresses.
[4] Set the Regex for email field on patron registration library
setting to the multiple-email form listed above. Reload
the patron registration form and verify that it will
continue to accept multiple email addresses but will not
accept entry that doesn't look like an email address.
[5] Set the library setting to the single-address value. Reload
the patron registration form; this time it should accept
a valid email address but not multiple ones.
Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>