From 7b70c13f3f781dbf4c700eb4a6c2201b2d9e1271 Mon Sep 17 00:00:00 2001 From: Patrick Toal Date: Sat, 18 Nov 2023 00:49:06 -0500 Subject: [PATCH] Add beginning of Google Auth --- src/boot/appwrite.ts | 2 +- src/components/GoogleOauthComponent.vue | 8 ++ src/pages/IndexPage.vue | 6 - src/pages/LoginPage.vue | 6 +- src/pages/PrivacyPolicyPage.vue | 163 ++++++++++++++++++++++++ src/pages/TermsOfServicePage.vue | 119 +++++++++++++++++ src/privacypolicy.html | 163 ++++++++++++++++++++++++ src/router/index.ts | 1 - src/router/routes.ts | 16 +++ src/stores/auth.ts | 11 +- src/tos.html | 117 +++++++++++++++++ 11 files changed, 599 insertions(+), 13 deletions(-) create mode 100644 src/components/GoogleOauthComponent.vue create mode 100644 src/pages/PrivacyPolicyPage.vue create mode 100644 src/pages/TermsOfServicePage.vue create mode 100644 src/privacypolicy.html create mode 100644 src/tos.html diff --git a/src/boot/appwrite.ts b/src/boot/appwrite.ts index ed02b28..5f0487f 100644 --- a/src/boot/appwrite.ts +++ b/src/boot/appwrite.ts @@ -18,7 +18,7 @@ export default boot(({ app, urlPath, router }) => { // Initialize store const authStore = useAuthStore(); authStore.init().then(() => { - authStore.currentUser && router.replace('/'); + authStore.currentUser ? router.replace('/') : router.replace('login'); }); }); diff --git a/src/components/GoogleOauthComponent.vue b/src/components/GoogleOauthComponent.vue new file mode 100644 index 0000000..d2fc7c2 --- /dev/null +++ b/src/components/GoogleOauthComponent.vue @@ -0,0 +1,8 @@ + + + diff --git a/src/pages/IndexPage.vue b/src/pages/IndexPage.vue index 674c123..9f5a1fc 100644 --- a/src/pages/IndexPage.vue +++ b/src/pages/IndexPage.vue @@ -23,14 +23,8 @@ diff --git a/src/pages/LoginPage.vue b/src/pages/LoginPage.vue index 819c910..14061a5 100644 --- a/src/pages/LoginPage.vue +++ b/src/pages/LoginPage.vue @@ -44,6 +44,7 @@ > --> + @@ -68,10 +69,7 @@ diff --git a/src/pages/TermsOfServicePage.vue b/src/pages/TermsOfServicePage.vue new file mode 100644 index 0000000..7725528 --- /dev/null +++ b/src/pages/TermsOfServicePage.vue @@ -0,0 +1,119 @@ + + + diff --git a/src/privacypolicy.html b/src/privacypolicy.html new file mode 100644 index 0000000..d5e991f --- /dev/null +++ b/src/privacypolicy.html @@ -0,0 +1,163 @@ + + + diff --git a/src/router/index.ts b/src/router/index.ts index 8a2188e..7437246 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -41,7 +41,6 @@ export default route(function (/* { store, ssrContext } */) { if (!auth.ready) { return false; } - if (auth.currentUser) { return to.meta.accountRoute ? { name: 'index' } : true; } else { diff --git a/src/router/routes.ts b/src/router/routes.ts index a56c754..e5ea754 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -71,6 +71,22 @@ const routes: RouteRecordRaw[] = [ publicRoute: true, }, }, + { + path: '/terms-of-service', + component: () => import('pages/TermsOfServicePage.vue'), + name: 'tospage', + meta: { + publicRoute: true, + }, + }, + { + path: '/privacy-policy', + component: () => import('pages/PrivacyPolicyPage.vue'), + name: 'privacy-policy', + meta: { + publicRoute: true, + }, + }, // { // path: '/register', // component: () => import('pages/RegisterPage.vue'), diff --git a/src/stores/auth.ts b/src/stores/auth.ts index 112841d..1d7ab78 100644 --- a/src/stores/auth.ts +++ b/src/stores/auth.ts @@ -2,6 +2,7 @@ import { defineStore } from 'pinia'; import { ID, account } from 'boot/appwrite'; import type { Models } from 'appwrite'; import { ref } from 'vue'; +import { useRouter } from 'vue-router'; export const useAuthStore = defineStore('auth', () => { const currentUser = ref | null>(null); @@ -24,10 +25,18 @@ export const useAuthStore = defineStore('auth', () => { await account.createEmailSession(email, password); currentUser.value = await account.get(); } + async function googleLogin() { + account.createOAuth2Session( + 'google', + 'https://bab.toal.ca/', + 'https://bab.toal.ca/#/login' + ); + currentUser.value = await account.get(); + } function logout() { return account.deleteSession('current').then((currentUser.value = null)); } - return { currentUser, register, login, logout, init, ready }; + return { currentUser, register, login, googleLogin, logout, init, ready }; }); diff --git a/src/tos.html b/src/tos.html new file mode 100644 index 0000000..503f59c --- /dev/null +++ b/src/tos.html @@ -0,0 +1,117 @@ + + +

Website Terms and Conditions of Use

+ +

1. Terms

+ +

+ By accessing this Website, accessible from https://bab.toal.ca, you are + agreeing to be bound by these Website Terms and Conditions of Use and + agree that you are responsible for the agreement with any applicable local + laws. If you disagree with any of these terms, you are prohibited from + accessing this site. The materials contained in this Website are protected + by copyright and trade mark law. +

+ +

2. Use License

+ +

+ Permission is granted to temporarily download one copy of the materials on + bab.toal.ca's Website for personal, non-commercial transitory viewing + only. This is the grant of a license, not a transfer of title, and under + this license you may not: +

+ + + +

+ This will let bab.toal.ca to terminate upon violations of any of these + restrictions. Upon termination, your viewing right will also be terminated + and you should destroy any downloaded materials in your possession whether + it is printed or electronic format. These Terms of Service has been + created with the help of the + Terms Of Service Generator. +

+ +

3. Disclaimer

+ +

+ All the materials on bab.toal.ca's Website are provided "as is". + bab.toal.ca makes no warranties, may it be expressed or implied, therefore + negates all other warranties. Furthermore, bab.toal.ca does not make any + representations concerning the accuracy or reliability of the use of the + materials on its Website or otherwise relating to such materials or any + sites linked to this Website. +

+ +

4. Limitations

+ +

+ bab.toal.ca or its suppliers will not be hold accountable for any damages + that will arise with the use or inability to use the materials on + bab.toal.ca's Website, even if bab.toal.ca or an authorize representative + of this Website has been notified, orally or written, of the possibility + of such damage. Some jurisdiction does not allow limitations on implied + warranties or limitations of liability for incidental damages, these + limitations may not apply to you. +

+ +

5. Revisions and Errata

+ +

+ The materials appearing on bab.toal.ca's Website may include technical, + typographical, or photographic errors. bab.toal.ca will not promise that + any of the materials in this Website are accurate, complete, or current. + bab.toal.ca may change the materials contained on its Website at any time + without notice. bab.toal.ca does not make any commitment to update the + materials. +

+ +

6. Links

+ +

+ bab.toal.ca has not reviewed all of the sites linked to its Website and is + not responsible for the contents of any such linked site. The presence of + any link does not imply endorsement by bab.toal.ca of the site. The use of + any linked website is at the user's own risk. +

+ +

7. Site Terms of Use Modifications

+ +

+ bab.toal.ca may revise these Terms of Use for its Website at any time + without prior notice. By using this Website, you are agreeing to be bound + by the current version of these Terms and Conditions of Use. +

+ +

8. Your Privacy

+ +

Please read our Privacy Policy.

+ +

9. Governing Law

+ +

+ Any claim related to bab.toal.ca's Website shall be governed by the laws + of ca without regards to its conflict of law provisions. +

+ +