Skip to content

Commit

Permalink
Update OAuth login popup for edge case (#168)
Browse files Browse the repository at this point in the history
部分浏览器插件会在网页加载时,通过特定的 postMessage 判断页面是否已经可以通信。

当前写法,会在收到所有 postMessage 消息时,关闭当前登录弹框,表现为页面一加载就自动关闭了。目前将关闭弹框调用移至获取到密钥后。

另:直接写 `window.postMessage` 应该没有任何作用,所以移除

Co-authored-by: Shenghang Tsai <[email protected]>
  • Loading branch information
KwokKwok and jackalcooper authored Oct 16, 2024
1 parent daa35e6 commit af0208b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions js/dialog/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ export const openOAuthPopup = async (setKey) => {
window.addEventListener('message', (event) => {
if (event.data.length > 0 && event.data[0]['secretKey'] !== undefined) {
setKey(event.data[0]['secretKey']);
popup.close();
}
popup.close();
});
window.postMessage
}

0 comments on commit af0208b

Please sign in to comment.