Bug 14266: Trim the email address in the pl script
The original concern of bug 14266 was to provide a compatibility for
<IE9.
But actually we don't need to trim the email address template side.
It will even better to trim it in the perl script, so that the email
will be trimed even if JS is disabled.
Test plan:
1/ Share a list and does not provide any email address
2/ Submit
=> The form is not submited, no alert/message is displayed (same as
before this patch).
3/ Share a list and provide an email address with spaces before and
after
4/ Submit
=> You should receive the email
Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com>
Test output compliant with expected test plan outcome.
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
(cherry picked from commit c7a8e4dd25)
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Liz Rea <wizzyrea@gmail.com>
This commit is contained in:
parent
3dbf30c17d
commit
53318a5ea5
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
[% ELSIF op=='invite' %]
|
||||
<div id="invite">
|
||||
<form method="post" onsubmit="return $.trim($('#invite_address').val())!='';">
|
||||
<form id="share_list">
|
||||
<fieldset class="rows">
|
||||
<ol>
|
||||
<input type="hidden" name="op" value="conf_invite"/>
|
||||
|
|
@ -89,4 +89,17 @@
|
|||
</div> <!-- / .container-fluid -->
|
||||
</div> <!-- / .main -->
|
||||
[% INCLUDE 'opac-bottom.inc' %]
|
||||
[% BLOCK jsinclude %][% END %]
|
||||
[% BLOCK jsinclude %]
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$(document).ready(function(){
|
||||
$("#share_list").on('submit', function(e) {
|
||||
var address = $("#invite_address").val();
|
||||
if ( address.length == 0) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -60,6 +60,12 @@ sub _init {
|
|||
$param->{fail_addr} = [];
|
||||
$param->{errcode} = check_common_errors($param);
|
||||
|
||||
# trim email address
|
||||
if ( $param->{addrlist} ) {
|
||||
$param->{addrlist} =~ s|^\s+||;
|
||||
$param->{addrlist} =~ s|\s+$||;
|
||||
}
|
||||
|
||||
#get some list details
|
||||
my @temp;
|
||||
@temp = GetShelf( $param->{shelfnumber} ) if !$param->{errcode};
|
||||
|
|
|
|||
Loading…
Reference in New Issue