Skip to content

Commit

Permalink
delete loan cookies when book is returned from within the browser
Browse files Browse the repository at this point in the history
  • Loading branch information
rajbot committed Jan 29, 2011
1 parent 3cd82ee commit 02ee5e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion BookReader/BookReader.js
Expand Up @@ -4599,7 +4599,7 @@ BookReader.prototype.gotOpenLibraryRecord = function(self, olObject) {
.appendTo('#BRreturn');
*/

$('<form id="BRreturnform" action="' + returnUrl + '" method="post"><input type="submit" value="Return book" /><input type="hidden" name="action" value="return" /></form>')
$('<form id="BRreturnform" action="' + returnUrl + '" method="post"><input type="submit" value="Return book" onclick="olAuth.deleteCookies();"/><input type="hidden" name="action" value="return" /></form>')
.appendTo('#BRreturn');

} else {
Expand Down
15 changes: 15 additions & 0 deletions BookReaderIA/datanode/BookReaderJSIA.php
Expand Up @@ -676,6 +676,21 @@ function OLAuth() {
}
}

OLAuth.prototype.deleteCookies = function() {
var date = new Date();
date.setTime(date.getTime()-(24*60*60*1000)); //one day ago
var expiry = date.toGMTString();
var cookie = 'loan-'+br.bookId+'=""';
cookie += '; expires='+expiry;
cookie += '; path=/; domain=.archive.org;';
document.cookie = cookie;

cookie = 'br-loan-'+br.bookId+'=""';
cookie += '; expires='+expiry;
cookie += '; path=/; domain=.archive.org;';
document.cookie = cookie;
}

OLAuth.prototype.startPolling = function () {
var self = this;
this.poller=setInterval(function(){
Expand Down

0 comments on commit 02ee5e2

Please sign in to comment.