Tweak URL matching regexp to be more precise

Institutional login process goes through multiple pages, the URL regexp
is tweaked to be more precise to ensure that no arbitrary URLs are
matched while polling for the final URL with auth code.
This commit is contained in:
Tom Najdek 2021-11-25 00:55:17 +01:00
parent d03c495563
commit 34d62426c3
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77

View file

@ -857,7 +857,7 @@ var Zotero_File_Interface = new function() {
this.authenticateMendeleyOnlinePoll = function (win) {
if (win && win[0] && win[0].location) {
const matchResult = win[0].location.toString().match(/(?:\?|&)code=(.*?)(?:&|$)/i);
const matchResult = win[0].location.toString().match(/mendeley_oauth_redirect.html(?:.*?)(?:\?|&)code=(.*?)(?:&|$)/i);
if (matchResult) {
const mendeleyCode = matchResult[1];
Zotero.getMainWindow().setTimeout(() => this.showImportWizard({ mendeleyCode }), 0);