Skip to content

Commit

Permalink
core: use target _blank when starting oauth from inside iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Feb 25, 2023
1 parent 1588ea2 commit 0bdb402
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions plugins/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@scrypted/core",
"version": "0.1.91",
"version": "0.1.92",
"description": "Scrypted Core plugin. Provides the UI, websocket, and engine.io APIs.",
"author": "Scrypted",
"license": "Apache-2.0",
Expand Down
12 changes: 10 additions & 2 deletions plugins/core/ui/src/interfaces/OauthClient.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
<v-btn text color="primary" @click="onClick">Login</v-btn>
</template>
<script>
import RPCInterface from "./RPCInterface.vue";
import qs from 'query-string';
import RPCInterface from "./RPCInterface.vue";
export default {
mixins: [RPCInterface],
methods: {
onChange() { },
isIFrame() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
},
onClick: function () {
this.rpc()
.getOauthUrl()
Expand Down Expand Up @@ -40,7 +47,8 @@ export default {
r: window.location.toString(),
});
url.search = qs.stringify(querystring);
window.location = url.toString();
const target = this.isIFrame() ? '_blank' : undefined;
window.open(url.toString(), target);
});
}
}
Expand Down

0 comments on commit 0bdb402

Please sign in to comment.