Skip to content
Snippets Groups Projects
Commit f1e6f172 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Fixed lightbox login event handling.

parent b385b034
No related merge requests found
...@@ -18,7 +18,7 @@ VuFind.lightbox = (function() { ...@@ -18,7 +18,7 @@ VuFind.lightbox = (function() {
if ('undefined' == typeof details) { if ('undefined' == typeof details) {
details = {}; details = {};
} }
document.dispatchEvent( return document.dispatchEvent(
new CustomEvent(msg, { new CustomEvent(msg, {
detail: details, detail: details,
bubbles: true, bubbles: true,
...@@ -132,15 +132,17 @@ VuFind.lightbox = (function() { ...@@ -132,15 +132,17 @@ VuFind.lightbox = (function() {
|| obj.url.match(/catalogLogin/)) // or catalog login for holds || obj.url.match(/catalogLogin/)) // or catalog login for holds
&& $('<div/>').html(html).find('.flash-message.alert-danger').length == 0 // skip failed logins && $('<div/>').html(html).find('.flash-message.alert-danger').length == 0 // skip failed logins
) { ) {
var eventResult = _emit('VuFind.lightbox.login', {
originalUrl: _originalUrl,
formUrl: obj.url
});
if (_originalUrl.match(/UserLogin/) || obj.url.match(/catalogLogin/)) { if (_originalUrl.match(/UserLogin/) || obj.url.match(/catalogLogin/)) {
_refreshPage(); if (eventResult) {
_refreshPage();
}
return false; return false;
} else { } else {
VuFind.lightbox.refreshOnClose = true; VuFind.lightbox.refreshOnClose = true;
_emit('VuFind.lightbox.login', {
originalUrl: _originalUrl,
formUrl: obj.url
});
} }
} }
_update(html); _update(html);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment