⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
resources
/
js
/
components
/
Edit File: LoginWithGithub.vue
<template> <button v-if="githubAuth" class="btn btn-dark ml-auto" type="button" @click="login" > {{ $t('login_with') }} <fa :icon="['fab', 'github']" /> </button> </template> <script> export default { name: 'LoginWithGithub', computed: { githubAuth: () => window.config.githubAuth, url: () => '/api/oauth/github', }, mounted() { window.addEventListener('message', this.onMessage, false) }, beforeDestroy() { window.removeEventListener('message', this.onMessage) }, methods: { async login() { const newWindow = openWindow('', this.$t('login')) const url = await this.$store.dispatch('auth/fetchOauthUrl', { provider: 'github', }) newWindow.location.href = url }, /** * @param {MessageEvent} e */ onMessage(e) { if (e.origin !== window.origin || !e.data.token) { return } this.$store.dispatch('auth/saveToken', { token: e.data.token, }) this.$router.push({ name: 'home' }) }, }, } /** * @param {Object} options * @return {Window} */ function openWindow(url, title, options = {}) { if (typeof url === 'object') { options = url url = '' } options = { url, title, width: 600, height: 720, ...options } const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screen.left const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screen.top const width = window.innerWidth || document.documentElement.clientWidth || window.screen.width const height = window.innerHeight || document.documentElement.clientHeight || window.screen.height options.left = width / 2 - options.width / 2 + dualScreenLeft options.top = height / 2 - options.height / 2 + dualScreenTop const optionsStr = Object.keys(options) .reduce((acc, key) => { acc.push(`${key}=${options[key]}`) return acc }, []) .join(',') const newWindow = window.open(url, title, optionsStr) if (window.focus) { newWindow.focus() } return newWindow } </script>
Simpan