+
@@ -89,7 +89,7 @@
Google 注册
diff --git a/open-isle-cli/src/main.js b/open-isle-cli/src/main.js index 7a48c5a4d..3642b4dac 100644 --- a/open-isle-cli/src/main.js +++ b/open-isle-cli/src/main.js @@ -8,8 +8,9 @@ import './assets/toast.css' // Use Sugar theme from vue-toast-notification for better toast styling. // If you prefer Bootstrap style, replace with theme-bootstrap.css instead. import { useToast } from 'vue-toastification' -import { checkToken, clearToken } from './utils/auth' +import { checkToken, clearToken, isLogin } from './utils/auth' import { initTheme } from './utils/theme' +import { loginWithGoogle } from './utils/google' // Configurable API domain and port // export const API_DOMAIN = 'http://127.0.0.1' @@ -47,4 +48,10 @@ checkToken().then(valid => { if (!valid) { clearToken() } + + if (!isLogin()) { + setTimeout(() => { + loginWithGoogle() + }, 3000) + } }) diff --git a/open-isle-cli/src/utils/google.js b/open-isle-cli/src/utils/google.js index 183c838e5..45c92689e 100644 --- a/open-isle-cli/src/utils/google.js +++ b/open-isle-cli/src/utils/google.js @@ -50,3 +50,11 @@ export async function googleSignIn(redirect_success, redirect_not_approved) { /* ignore */ } } + +export function loginWithGoogle() { + googleSignIn(() => { + this.$router.push('/') + }, (token) => { + this.$router.push('/signup-reason?token=' + token) + }) +} \ No newline at end of file diff --git a/open-isle-cli/src/views/HomePageView.vue b/open-isle-cli/src/views/HomePageView.vue index 2199cc22f..034fa646b 100644 --- a/open-isle-cli/src/views/HomePageView.vue +++ b/open-isle-cli/src/views/HomePageView.vue @@ -111,7 +111,7 @@ import { ref, onMounted, watch } from 'vue' import { useRoute } from 'vue-router' import { stripMarkdown } from '../utils/markdown' import { API_BASE_URL } from '../main' -import { getToken } from '../utils/auth' +import { getToken, isLogin } from '../utils/auth' import TimeManager from '../utils/time' import CategorySelect from '../components/CategorySelect.vue' import TagSelect from '../components/TagSelect.vue' @@ -120,6 +120,7 @@ import ArticleCategory from '../components/ArticleCategory.vue' import SearchDropdown from '../components/SearchDropdown.vue' import { hatch } from 'ldrs' import { isMobile } from '../utils/screen' +import { loginWithGoogle } from '../utils/google' hatch.register() @@ -364,6 +365,12 @@ export default { onMounted(async () => { await loadOptions() fetchContent() + if (!isLogin()) { + // + } + setTimeout(() => { + loginWithGoogle() + }, 3000) }) watch([selectedCategory, selectedTags], () => { diff --git a/open-isle-cli/src/views/LoginPageView.vue b/open-isle-cli/src/views/LoginPageView.vue index e0e2f1d2e..172a19da1 100644 --- a/open-isle-cli/src/views/LoginPageView.vue +++ b/open-isle-cli/src/views/LoginPageView.vue @@ -53,7 +53,7 @@ diff --git a/open-isle-cli/src/views/SignupPageView.vue b/open-isle-cli/src/views/SignupPageView.vue index acc9840cc..a8bb28c25 100644 --- a/open-isle-cli/src/views/SignupPageView.vue +++ b/open-isle-cli/src/views/SignupPageView.vue @@ -67,7 +67,7 @@