Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt
Jonathan Druart dcd1f5d48c Bug 13618: Add html filters to all the variables
Here we go, next step then.
As we did not fix the performance issue when autofiltering
the variables (see bug 20975), the only solution we have is to add the
filters explicitely.

This patch has been autogenerated (using add_html_filters.pl, see next
pathces) and add the html filter to all the variables displayed in the
template.
Exceptions are made (using the new 'raw' TT filter) to the variable we
already listed in the previous versions of this patch.

To test:
- Use t/db_dependent/Koha/Patrons.t to populate your DB with autogenerated
data which contain <script> tags

- Remove them from borrower_debarments.comments (there are allowed here)
update  borrower_debarments set comment="html tags possible here";

- From the interface hit page and try to catch alert box.
If you find one it means you find a possible XSS.
To know where it comes from:
* note the exact URL where you found it
* note the alert box content
* Dump your DB and search for the string in the dump to identify its
location (for instance table.field)

Next:
* Ideally we would like to use the raw filter when it is not necessary
to HTML escape the variables (in big loop for instance)
* Provide a QA script to catch missing filters (we want html, uri, url
or raw, certainly others that I am forgetting now)
* Replace the html filters with uri when needed (!)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-17 15:55:05 +00:00

111 lines
5.3 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Change your password</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-passwd' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Change your password</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="span10">
<div id="userpasswd">
<h3>Change your password </h3>
[% IF ( Error_messages ) %]
<div class="alert">
<h3>There was a problem with your submission</h3>
<p>
[% IF ( passwords_mismatch ) %]
Passwords do not match. Please re-type your new password.
[% END %]
[% IF password_too_short %]
Password must be at least [% minPasswordLength | html %] characters long.
[% END %]
[% IF password_too_weak %]
Password must contain at least one digit, one lowercase and one uppercase.
[% END %]
[% IF password_has_whitespaces %]
Password must not contain leading or trailing whitespaces.
[% END %]
[% IF ( WrongPass ) %]
Your current password was entered incorrectly. If this problem persists, please ask a librarian to reset your password for you.
[% END %]
</p>
</div>
[% END # /IF Error_messages %]
[% IF ( OpacPasswordChange ) %]
[% IF ( Ask_data ) %]
<form action="/cgi-bin/koha/opac-passwd.pl" name="mainform" id="mainform" method="post" autocomplete="off">
<fieldset>
[% UNLESS ( ShortPass ) %]<div class="alert alert-info">Your password must be at least [% minPasswordLength | html %] characters long.</div>[% END %]
<label for="Oldkey">Current password:</label> <input type="password" id="Oldkey" size="25" name="Oldkey" />
<label for="Newkey">New password:</label> <input type="password" id="Newkey" size="25" name="Newkey" />
<label for="Confirm">Re-type new password:</label> <input type="password" id="Confirm" size="25" name="Confirm" />
</fieldset>
<fieldset class="action"><input type="submit" value="Submit changes" class="btn" /> <a href="/cgi-bin/koha/opac-user.pl" class="cancel">Cancel</a></fieldset>
</form>
[% END # /IF Ask_data %]
[% ELSE %]
<div class="alert">You can't change your password.</div>
[% END # /IF OpacPasswordChange %]
[% IF ( password_updated ) %]
<div class="alert alert-success">
<h1>Password updated</h1>
Your password has been changed
</div>
<form action="/cgi-bin/koha/opac-user.pl" method="post" autocomplete="off">
<input type="hidden" name="borrowernumber" value="[% borrowernumber | html %]" />
<p><input type="submit" class="btn" value="Return to your record" /></p>
</form>
[% END # /IF password_updated %]
</div> <!-- / #userpasswd -->
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %]
[% PROCESS 'password_check.inc' %]
[% PROCESS 'add_password_check' new_password => 'Newkey' %]
<script>
$(document).ready(function() {
$("#mainform").validate({
rules: {
Newkey: {
required: true,
password_strong: true,
password_no_spaces: true
},
Confirm: {
required: true,
password_match: true
}
}
});
});
</script>
[% END %]