From da7f28081a0f2933027f474ed20a4a243700f63f Mon Sep 17 00:00:00 2001 From: Christos Panagiotakopoulos Date: Fri, 28 Oct 2022 12:16:01 +0200 Subject: [PATCH 1/3] feat: init register --- src/pages/Register.vue | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/pages/Register.vue b/src/pages/Register.vue index 3fa8e6f..c7176bf 100644 --- a/src/pages/Register.vue +++ b/src/pages/Register.vue @@ -3,12 +3,12 @@ import { onMounted, ref } from 'vue'; import CapsuleIcon from '@/components/icons/CapsuleIcon.vue'; import RegisterMethods from '@/components/register/RegisterMethods.vue'; import SignUp from '@/components/register/SignUp.vue'; -import useLogin, { Status } from '@/plugins/loginMethods'; +import useLogin, { ITorusResponse, Status } from '@/plugins/loginMethods'; import router from '@/router'; -import { toastError, toastWarning } from '@/plugins/toast'; +import { toastError } from '@/plugins/toast'; -const isLoading = ref(false); -const step = ref<`registerMethods` | `signUp`>(`registerMethods`); +const isLoading = ref(false); +const userInfo = ref(null); const login = useLogin(); onMounted(async () => { @@ -18,12 +18,8 @@ onMounted(async () => { if (userData) { const res = await login.verify(userData.privateKey); switch (res) { - case Status.NO_ACCOUNT: - // If no username is found then register... - toastWarning(`looks like you don't have an account`); - return; case Status.BLOCKED: - // If account is blocked then send to register page... + // If account is blocked then send to home page... toastError(`Your account has been deactivated or banned`); router.push(`/home`); return; @@ -31,11 +27,16 @@ onMounted(async () => { router.push(`/home`); location.reload(); return; + case Status.NO_ACCOUNT: + userInfo.value = userData; } } isLoading.value = false; - } catch (err) { - console.log(err); + } catch (err: unknown) { + console.error(err); + if (err instanceof Error) { + toastError(err.message); + } } }); @@ -58,8 +59,8 @@ onMounted(async () => {
- - + +

From 109bab6995d8014e04574b50fdcbd078681fdc1a Mon Sep 17 00:00:00 2001 From: Christos Panagiotakopoulos Date: Fri, 28 Oct 2022 13:15:19 +0200 Subject: [PATCH 2/3] feat: registration --- package.json | 1 + public/index.html | 1 + src/components/register/SignUp.vue | 133 ++++++++++++++++++++++++++++- src/pages/Register.vue | 2 +- tsconfig.json | 2 +- yarn.lock | 5 ++ 6 files changed, 141 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c14cb19..d5ed5d2 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "vue3-lazyload": "^0.3.6" }, "devDependencies": { + "@hcaptcha/types": "^1.0.3", "@babel/core": "^7.19.1", "@babel/eslint-parser": "^7.19.1", "@playwright/test": "^1.25.2", diff --git a/public/index.html b/public/index.html index 5f1393c..6a6bef3 100644 --- a/public/index.html +++ b/public/index.html @@ -5,6 +5,7 @@ + <%= htmlWebpackPlugin.options.title %> diff --git a/src/components/register/SignUp.vue b/src/components/register/SignUp.vue index f31a394..c917029 100644 --- a/src/components/register/SignUp.vue +++ b/src/components/register/SignUp.vue @@ -1 +1,132 @@ - + + + diff --git a/src/pages/Register.vue b/src/pages/Register.vue index c7176bf..f811cac 100644 --- a/src/pages/Register.vue +++ b/src/pages/Register.vue @@ -60,7 +60,7 @@ onMounted(async () => {

- +

diff --git a/tsconfig.json b/tsconfig.json index dfd194a..1017dbb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,7 @@ "sourceMap": true, "baseUrl": ".", "noUnusedLocals": true, - "types": ["webpack-env"], + "types": ["webpack-env", "@hcaptcha/types"], "paths": { "@/*": ["src/*"] }, diff --git a/yarn.lock b/yarn.lock index 1f09cf0..a8d08c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1275,6 +1275,11 @@ dependencies: "@hapi/hoek" "^9.0.0" +"@hcaptcha/types@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@hcaptcha/types/-/types-1.0.3.tgz#baf10a4361a45ff1c64862dfb8dc9bbc8292a8fe" + integrity sha512-1mbU6eSGawRrqeahRrOzZo/SVLI6oZ5/azuBpSyVrRRR96CnS3fOVDWfzxpngfxKD0/I9Rwu6c/3ITqD8rXeTQ== + "@humanwhocodes/config-array@^0.11.6": version "0.11.6" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.6.tgz#6a51d603a3aaf8d4cf45b42b3f2ac9318a4adc4b" From 220ce8c70ba819e34aa32b8a38b363c4fad3f6e1 Mon Sep 17 00:00:00 2001 From: Christos Panagiotakopoulos Date: Tue, 1 Nov 2022 11:32:52 +0000 Subject: [PATCH 3/3] feat: registration more things --- src/components/register/SignUp.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/register/SignUp.vue b/src/components/register/SignUp.vue index c917029..4593fa9 100644 --- a/src/components/register/SignUp.vue +++ b/src/components/register/SignUp.vue @@ -17,11 +17,6 @@ const props = defineProps<{ privateKey: string }>(); const login = useLogin(); -function back() { - localStorage.clear(); - location.reload(); -} - async function handleRegisterID() { try { if (!captchaID.value) { @@ -68,6 +63,11 @@ async function handleRegisterID() { } } +function back() { + localStorage.clear(); + location.reload(); +} + onMounted(async () => { const doc = document.getElementById(`hcaptcha`); if (!doc) {