Przeglądaj źródła

fix: strip protocol before comparing urls

Ifedapo Olarewaju 6 lat temu
rodzic
commit
a22c897013
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      src/views/ProviderView/index.js

+ 2 - 1
src/views/ProviderView/index.js

@@ -451,8 +451,9 @@ module.exports = class ProviderView {
     const link = `${this.Provider.authUrl()}?state=${authState}`
 
     const authWindow = window.open(link, '_blank')
+    const noProtocol = (url) => url.replace(/^(https?:|)\/\//, '')
     const handleToken = (e) => {
-      if (e.origin !== this.plugin.opts.host || e.source !== authWindow) {
+      if (noProtocol(e.origin) !== noProtocol(this.plugin.opts.host) || e.source !== authWindow) {
         return
       }
       authWindow.close()