瀏覽代碼

fix: strip protocol before comparing urls

Ifedapo Olarewaju 6 年之前
父節點
當前提交
a22c897013
共有 1 個文件被更改,包括 2 次插入1 次删除
  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()