Bug 21542: Use modal and password field for overdrive password

To test:
 1 - Enabled Overdrive and fill all preferences
 2 - Make sure OverDrivePasswordRequired is true
 3 - Go to opac account
 4 - Log in to overdrive
 5 - Note the input is shown
 6 - Apply patch
 7 - Repeat
 8 - Note popup is now a modal
 9 - Note password is now hidden
10 - Confirm overdrive integration works as before

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

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-10-10 15:53:13 +00:00
parent dc6bea7860
commit 32dc4a7bfa
3 changed files with 31 additions and 3 deletions

View file

@ -0,0 +1,18 @@
<div id="overdrive-login" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="overdrive-login-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="overdrive-login-label">Login</h3>
</div>
<form action="#" method="post" id="overdrive-login-form">
<div class="modal-body">
<fieldset class="brief">
<label for="ODpassword">Password:</label>
<input type="password" name="ODpassword" value="" />
</fieldset>
</div>
<div class="modal-footer">
<input type="submit" class="btn btn-primary overdrive-checkout-submit" value="Login" />
<a href="#" data-dismiss="modal" aria-hidden="true" class="cancel">Cancel</a>
</div>
</form> <!-- /#overdrive-login-form -->
</div> <!-- /#overdrive-login -->

View file

@ -896,7 +896,10 @@
</div> <!-- /#main -->
[% IF ( OverDriveCirculation ) %]
[% INCLUDE 'overdrive-checkout.inc' %]
[% INCLUDE 'overdrive-checkout.inc' %]
[% IF ( Koha.Preference('OverDrivePasswordRequired') ) %]
[% INCLUDE 'overdrive-login.inc' %]
[% END %]
[% END %]
[% IF ( RecordedBooksCirculation ) %]
[% INCLUDE 'recordedbooks-checkout.inc' %]

View file

@ -71,10 +71,11 @@ KOHA.OverDriveCirculation = new function() {
var login_link = $('<a href="#">')
.click(function(e) {
e.preventDefault();
var passwd = OD_password_required ? prompt("Please enter your password") : "";
login(passwd);
if( OD_password_required ) { $("#overdrive-login").modal('show'); }
else { login(""); }
})
.text(_("Login to OverDrive account"));
var login_div = $('<div class="overdrive-login">').append(login_link);
var details = null;
@ -97,6 +98,12 @@ KOHA.OverDriveCirculation = new function() {
window.close();
}
checkout_popup = $("#overdrive-checkout");
$("#overdrive-login-form").submit(function(e){
e.preventDefault();
$("#overdrive-login").modal('hide');
var ODpassword = $("input[name='ODpassword']").val();
login( ODpassword );
});
});
function display_account (container, data) {