Postmessage to parent window to notify callback login

This commit is contained in:
Marcos Lilljedahl
2017-10-12 13:28:02 -03:00
parent 9f9c06cd31
commit 426acf1db3

View File

@@ -181,5 +181,20 @@ func LoginCallback(rw http.ResponseWriter, req *http.Request) {
return
}
fmt.Fprintf(rw, `<html><head><script>window.close();</script></head><body></body></html>`)
fmt.Fprintf(rw, `
<html>
<head>
<script>
if (window.opener && !window.opener.closed) {
try {
window.opener.postMessage('done','*')
}
catch(e) { }
window.close();
}
</script>
</head>
<body>
</body>
</html>`)
}