Bug 30733: Simplify translatable strings
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-reset-password.tt
1 [% USE raw %]
2 [% USE Koha %]
3 [% USE Categories %]
4 [% USE AdditionalContents %]
5 [% PROCESS 'html_helpers.inc' %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>
8     Reset your password
9     &rsaquo;
10  [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog
11 </title>
12 [% INCLUDE 'doc-head-close.inc' %]
13 [% BLOCK cssinclude %][% END %]
14 </head>
15 [% INCLUDE 'bodytag.inc' bodyid='opac-login-page' bodyclass='scrollto' %]
16 [% INCLUDE 'masthead.inc' %]
17
18 <div class="main">
19     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumbs">
20         <ol class="breadcrumb">
21             <li class="breadcrumb-item">
22                 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
23             </li>
24             <li class="breadcrumb-item active">
25                 <a href="#" aria-current="page">Reset your password</a>
26             </li>
27         </
28     </nav> <!-- /#breadcrumbs -->
29
30     <div class="container-fluid">
31         <div class="row justify-content-center">
32             <div class="col-md-10 col-lg-6">
33                 <div id="opac-auth" class="maincontent">
34                     [% IF Koha.Preference( 'opacuserlogin' ) && Koha.Preference('EnableExpiredPasswordReset') %]
35                         [% IF ( error ) %]
36                             <div class="alert alert-warning">
37                                 <h2>There was a problem with your submission</h2>
38                                 <p>
39                                     [% SWITCH error %]
40                                         [% CASE  'no_change' %]
41                                             <span>New password must not be the same as old password.</span>
42                                         [% CASE  'passwords_mismatch' %]
43                                             <span>Passwords do not match.  Please re-type your new password.</span>
44                                         [% CASE 'password_too_short' %]
45                                             <span>Password must be at least [% minPasswordLength | html %] characters long.</span>
46                                         [% CASE 'password_too_weak' %]
47                                             <span>Password must contain at least one digit, one lowercase and one uppercase.</span>
48                                         [% CASE 'password_has_whitespaces' %]
49                                             <span>Password must not contain leading or trailing whitespaces.</span>
50                                         [% CASE 'invalid_credentials' %]
51                                             <span>You entered an incorrect username or password. Please try again! But note that passwords are case sensitive[% IF Koha.Preference('FailedLoginAttempts') %] and that your account will be locked out after a fixed number of failed login attempts[% END %]. Please contact a library staff member if you continue to have problems.</span>
52                                         [% CASE 'no_expire' %]
53                                             Please log-in to account to update your password.</br>
54                                             <a href="/cgi-bin/koha/opac-user.pl" class="nav-link login-link loginModal-trigger"><i class="fa fa-user fa-icon-black fa-fw" aria-hidden="true"></i> <span class="userlabel">Log in to your account</span></a>.
55                                         [% CASE 'account_locked' %]
56                                             This account has been locked!
57                                             [% IF Categories.can_any_reset_password && Koha.Preference('OpacBaseURL') %]
58                                                 <a href="[% Koha.Preference('OpacBaseURL') | url %]/cgi-bin/koha/opac-password-recovery.pl">You must reset your password via e-mail</a>.
59                                             [% ELSE %]
60                                                 <span>You must contact the library for assistance.</span>
61                                             [% END %]
62                                         [% CASE %]
63                                             <span>An unknown error occurred. Please try again or contact the library for assistance.</span>
64                                     [% END %]
65                                 </p>
66                             </div>
67                         [% END %]
68                         [% IF ( password_updated ) %]
69                             <div class="alert dialog-alert">
70                                 <h2>Your password has successfully been updated</h2>
71                                 <a href="/cgi-bin/koha/opac-main.pl" class="btn btn-primary">Go to OPAC</a>
72                                 [% IF ( Koha.Preference('staffClientBaseURL') && staff_access ) %]
73                                     <a href="[% Koha.Preference('staffClientBaseURL') | url %]" class="btn btn-primary">Go to Staff client</a>
74                                 [% END %]
75                             </div>
76                         [% ELSE %]
77                         <form action="/cgi-bin/koha/opac-reset-password.pl" name="mainform" id="mainform" method="post" autocomplete="off">
78                             <legend class="sr-only">Reset your password</legend>
79
80                             <fieldset class="brief">
81                                 <div class="form-group">
82                                     <label for="userid">Login:</label>
83                                     <input class="form-control" type="text"  size="25" id="userid"  name="userid" />
84                                 </div>
85                                 <div class="form-group">
86                                     <label for="currentpassword">Current password:</label>
87                                     <input class="form-control" autocomplete="off" type="password"  size="25" id="currentpassword"  name="currentpassword" />
88                                 </div>
89                                 <div class="form-group">
90                                     <label for="newpassword">New password:</label>
91                                     <input class="form-control" autocomplete="off" type="password"  size="25" id="newpassword"  name="newpassword" />
92                                 </div>
93                                 <div class="form-group">
94                                     <label for="confirmpassword">Confirm new password:</label>
95                                     <input class="form-control" autocomplete="off" type="password"  size="25" id="confirmpassword"  name="confirmpassword" />
96                                 </div>
97                                 <fieldset class="action">
98                                     <input type="submit" value="Update password" class="btn btn-primary" />
99                                 </fieldset>
100                                 <input type="hidden" name="op" value="update" />
101                             </fieldset>
102                             [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
103                                 <div id="resetpassword">
104                                     <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
105                                 </div>
106                             [% END %]
107                         </form>
108                         [% END # /IF Error_messages %]
109
110                     [% ELSE %]
111                         <h1>Resetting your password has not been enabled by the library.</h1>
112                         [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
113                             <div id="resetpassword">
114                                 <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
115                             </div>
116                         [% ELSE %]
117                             <p>You must contact the library to reset your password</p>
118                         [% END %]
119                     [% END # / IF opacuserlogin %]
120
121                 </div> <!-- /.opac-auth -->
122             </div> <!-- /.col-md-10 col-lg-6 -->
123         </div> <!-- /.row -->
124     </div> <!-- /.container-fluid -->
125 </div> <!-- /.main -->
126
127 [% INCLUDE 'opac-bottom.inc' %]
128 [% BLOCK jsinclude %]
129     [% Asset.js("lib/jquery/plugins/jquery.validate.min.js") | $raw %]
130     <script>
131         jQuery.validator.addMethod("password_no_spaces", function(value, element){
132             return ( this.optional(element) || !value.match(/^\s/) && !value.match(/\s$/) );
133         }, _("Password contains leading and/or trailing spaces"));
134         jQuery.validator.addMethod("password_match", function(value, element){
135             var new_password_node = $("input[name='newpassword']:first");
136             return value == $(new_password_node).val();
137         }, _("Please enter the same password as above"));
138
139         $(document).ready(function() {
140             $("#mainform").validate({
141                 rules: {
142                     currentpassword: {
143                         required: true,
144                     },
145                     newpassword: {
146                         required: true,
147                         password_no_spaces: true
148                     },
149                     confirmpassword: {
150                         required: true,
151                         password_match: true
152                     }
153                 }
154             });
155         });
156     </script>
157 [% END %]