@adminforth/open-signup 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.woodpecker/buildRelease.sh +13 -0
- package/.woodpecker/buildSlackNotify.sh +44 -0
- package/.woodpecker/release.yml +42 -0
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/build.log +12 -0
- package/custom/SignupPage.vue +337 -0
- package/custom/SignupUnderLogin.vue +16 -0
- package/custom/tsconfig.json +19 -0
- package/dist/custom/SignupPage.vue +337 -0
- package/dist/custom/SignupUnderLogin.vue +16 -0
- package/dist/custom/tsconfig.json +19 -0
- package/dist/index.js +291 -0
- package/dist/types.js +1 -0
- package/index.ts +346 -0
- package/package.json +55 -0
- package/tsconfig.json +12 -0
- package/types.ts +68 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
#!/bin/bash
|
|
3
|
+
|
|
4
|
+
# write npm run output both to console and to build.log
|
|
5
|
+
npm run build 2>&1 | tee build.log
|
|
6
|
+
build_status=${PIPESTATUS[0]}
|
|
7
|
+
|
|
8
|
+
# if exist status from the npm run build is not 0
|
|
9
|
+
# then exit with the status code from the npm run build
|
|
10
|
+
if [ $build_status -ne 0 ]; then
|
|
11
|
+
echo "Build failed. Exiting with status code $build_status"
|
|
12
|
+
exit $build_status
|
|
13
|
+
fi
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-8)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if [ "$CI_STEP_STATUS" = "success" ]; then
|
|
9
|
+
MESSAGE="Did a build without issues on \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\`. Commit: _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
|
|
10
|
+
|
|
11
|
+
curl -s -X POST -H "Content-Type: application/json" -d '{
|
|
12
|
+
"username": "'"$CI_COMMIT_AUTHOR"'",
|
|
13
|
+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
|
|
14
|
+
"attachments": [
|
|
15
|
+
{
|
|
16
|
+
"mrkdwn_in": ["text", "pretext"],
|
|
17
|
+
"color": "#36a64f",
|
|
18
|
+
"text": "'"$MESSAGE"'"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}' "$DEVELOPERS_SLACK_WEBHOOK"
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
export BUILD_LOG=$(cat ./build.log)
|
|
25
|
+
|
|
26
|
+
BUILD_LOG=$(echo $BUILD_LOG | sed 's/"/\\"/g')
|
|
27
|
+
|
|
28
|
+
MESSAGE="Broke \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\` with commit _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
|
|
29
|
+
CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
|
|
30
|
+
|
|
31
|
+
echo "Sending slack message to developers $MESSAGE"
|
|
32
|
+
# Send the message
|
|
33
|
+
curl -sS -X POST -H "Content-Type: application/json" -d '{
|
|
34
|
+
"username": "'"$CI_COMMIT_AUTHOR"'",
|
|
35
|
+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
|
|
36
|
+
"attachments": [
|
|
37
|
+
{
|
|
38
|
+
"mrkdwn_in": ["text", "pretext"],
|
|
39
|
+
"color": "#8A1C12",
|
|
40
|
+
"text": "'"$CODE_BLOCK"'",
|
|
41
|
+
"pretext": "'"$MESSAGE"'"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}' "$DEVELOPERS_SLACK_WEBHOOK" 2>&1
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
clone:
|
|
2
|
+
git:
|
|
3
|
+
image: woodpeckerci/plugin-git
|
|
4
|
+
settings:
|
|
5
|
+
partial: false
|
|
6
|
+
depth: 5
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
init-secrets:
|
|
10
|
+
when:
|
|
11
|
+
- event: push
|
|
12
|
+
image: infisical/cli
|
|
13
|
+
environment:
|
|
14
|
+
INFISICAL_TOKEN:
|
|
15
|
+
from_secret: VAULT_TOKEN
|
|
16
|
+
commands:
|
|
17
|
+
- infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
|
|
18
|
+
secrets:
|
|
19
|
+
- VAULT_TOKEN
|
|
20
|
+
|
|
21
|
+
release:
|
|
22
|
+
image: node:20
|
|
23
|
+
when:
|
|
24
|
+
- event: push
|
|
25
|
+
commands:
|
|
26
|
+
- apt update && apt install -y rsync
|
|
27
|
+
- export $(cat /woodpecker/deploy.vault.env | xargs)
|
|
28
|
+
- npm clean-install
|
|
29
|
+
- /bin/bash ./.woodpecker/buildRelease.sh
|
|
30
|
+
- npm audit signatures
|
|
31
|
+
- npx semantic-release
|
|
32
|
+
|
|
33
|
+
slack-on-failure:
|
|
34
|
+
when:
|
|
35
|
+
- event: push
|
|
36
|
+
status: [failure, success]
|
|
37
|
+
- event: push
|
|
38
|
+
image: curlimages/curl
|
|
39
|
+
commands:
|
|
40
|
+
- export $(cat /woodpecker/deploy.vault.env | xargs)
|
|
41
|
+
- /bin/sh ./.woodpecker/buildSlackNotify.sh
|
|
42
|
+
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Devforth.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/build.log
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
> @adminforth/open-signup@1.0.9 build
|
|
3
|
+
> tsc && rsync -av --exclude 'node_modules' custom dist/
|
|
4
|
+
|
|
5
|
+
sending incremental file list
|
|
6
|
+
custom/
|
|
7
|
+
custom/SignupPage.vue
|
|
8
|
+
custom/SignupUnderLogin.vue
|
|
9
|
+
custom/tsconfig.json
|
|
10
|
+
|
|
11
|
+
sent 14,440 bytes received 77 bytes 29,034.00 bytes/sec
|
|
12
|
+
total size is 14,155 speedup is 0.98
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800 relative w-screen h-screen"
|
|
3
|
+
:style="coreStore.config?.loginBackgroundImage && backgroundPosition === 'over' ? {
|
|
4
|
+
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
|
|
5
|
+
'background-size': 'cover',
|
|
6
|
+
'background-position': 'center',
|
|
7
|
+
'background-blend-mode': 'darken'
|
|
8
|
+
}: {}"
|
|
9
|
+
>
|
|
10
|
+
|
|
11
|
+
<img v-if="coreStore.config?.loginBackgroundImage && backgroundPosition !== 'over'"
|
|
12
|
+
:src="loadFile(coreStore.config?.loginBackgroundImage)"
|
|
13
|
+
class="position-absolute top-0 left-0 h-screen object-cover w-0"
|
|
14
|
+
:class="{
|
|
15
|
+
'1/2': 'md:w-1/2',
|
|
16
|
+
'1/3': 'md:w-1/3',
|
|
17
|
+
'2/3': 'md:w-2/3',
|
|
18
|
+
'3/4': 'md:w-3/4',
|
|
19
|
+
'2/5': 'md:w-2/5',
|
|
20
|
+
'3/5': 'md:w-3/5',
|
|
21
|
+
}[backgroundPosition]"
|
|
22
|
+
/>
|
|
23
|
+
|
|
24
|
+
<!-- Main modal -->
|
|
25
|
+
<div id="authentication-modal" tabindex="-1"
|
|
26
|
+
class="overflow-y-auto flex flex-grow
|
|
27
|
+
overflow-x-hidden z-50 min-w-[350px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
28
|
+
<div class="relative p-4 w-full max-h-full max-w-[400px]">
|
|
29
|
+
<!-- Modal content -->
|
|
30
|
+
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black" >
|
|
31
|
+
<!-- Modal header -->
|
|
32
|
+
<div class="flex items-center justify-between p-4 md:p-5 border-b rounded-t dark:border-gray-600">
|
|
33
|
+
<h3 class="text-xl font-semibold text-gray-900 dark:text-white">
|
|
34
|
+
{{$t('Sign up into')}} {{ coreStore.config?.brandName }}
|
|
35
|
+
</h3>
|
|
36
|
+
</div>
|
|
37
|
+
<!-- Modal body -->
|
|
38
|
+
<div class="p-4 md:p-5">
|
|
39
|
+
<form v-if="!requestSent" class="space-y-4" role="alert" @submit.prevent>
|
|
40
|
+
<div v-if="!verifyToken" class="relative">
|
|
41
|
+
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your email address')}}</label>
|
|
42
|
+
<input type="email" name="email" id="email"
|
|
43
|
+
tabindex="1"
|
|
44
|
+
autocomplete="username"
|
|
45
|
+
@keydown.enter="passwordInput?.focus()"
|
|
46
|
+
ref="emailInput"
|
|
47
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
|
|
48
|
+
placeholder="name@company.com"
|
|
49
|
+
required
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<div v-if="isPasswordNeeded" class="relative">
|
|
53
|
+
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your password')}}</label>
|
|
54
|
+
<input
|
|
55
|
+
tabindex="2"
|
|
56
|
+
autocomplete="new-password"
|
|
57
|
+
ref="passwordInput"
|
|
58
|
+
:type="unmasked ? 'text' : 'password'"
|
|
59
|
+
name="password" id="password"
|
|
60
|
+
v-model="password"
|
|
61
|
+
@keydown.enter="passwordConfirmationInput?.focus()"
|
|
62
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
|
|
63
|
+
:placeholder="$t('New password')" required
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<button
|
|
67
|
+
type="button"
|
|
68
|
+
@click="unmasked = !unmasked"
|
|
69
|
+
class="h-6 absolute inset-y-2 top-9 right-1 flex items-center pr-2 z-index-100 focus:outline-none"
|
|
70
|
+
>
|
|
71
|
+
<IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked" />
|
|
72
|
+
<IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
|
|
73
|
+
</button>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div v-if="isPasswordNeeded" class="relative">
|
|
77
|
+
<label for="password_confirmation" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Confirm your password')}}</label>
|
|
78
|
+
<input
|
|
79
|
+
ref="passwordConfirmationInput"
|
|
80
|
+
autocomplete="new-password"
|
|
81
|
+
:type="unmasked ? 'text' : 'password'"
|
|
82
|
+
name="password_confirmation" id="password_confirmation"
|
|
83
|
+
tabindex="3"
|
|
84
|
+
v-model="passwordConfirmation"
|
|
85
|
+
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white"
|
|
86
|
+
:placeholder="$t('Confirm new password')" required
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<button
|
|
90
|
+
type="button"
|
|
91
|
+
@click="unmasked = !unmasked"
|
|
92
|
+
class="h-6 absolute inset-y-2 top-9 right-1 flex items-center pr-2 z-index-100 focus:outline-none"
|
|
93
|
+
>
|
|
94
|
+
<IconEyeSolid class="w-6 h-6 text-gray-400" v-if="!unmasked" />
|
|
95
|
+
<IconEyeSlashSolid class="w-6 h-6 text-gray-400" v-else />
|
|
96
|
+
</button>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div v-if="validationError || error" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
|
|
100
|
+
<svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
|
|
101
|
+
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
|
|
102
|
+
</svg>
|
|
103
|
+
<span class="sr-only">{{$t('Info')}}</span>
|
|
104
|
+
<div>
|
|
105
|
+
{{ validationError || error }}
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<Button
|
|
110
|
+
:disabled="inProgress || (validationRunning && validationError)"
|
|
111
|
+
@click="() => verifyToken ? signupAfterEmailConfirmation() : doSignup()"
|
|
112
|
+
type="submit"
|
|
113
|
+
class="w-full"
|
|
114
|
+
:loader="inProgress"
|
|
115
|
+
>
|
|
116
|
+
{{$t('Sign up')}}
|
|
117
|
+
</Button>
|
|
118
|
+
</form>
|
|
119
|
+
<!-- END of set new paasord -->
|
|
120
|
+
<div v-else class="flex items center justify-center p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-green-800 dark:text-green-400" role="alert">
|
|
121
|
+
{{$t('Please check your email at')}} {{ sentToEmail }} {{$t('to confirm your email address.')}}
|
|
122
|
+
</div>
|
|
123
|
+
<p class="text-gray-500 dark:text-gray-400 font-sm text-right mt-3">
|
|
124
|
+
{{$t('Already have an account?')}} <Link :to="`/login${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">{{ $t('login here') }}</Link>
|
|
125
|
+
</p>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
<script setup lang="ts">
|
|
136
|
+
import { onMounted, ref, computed, Ref, onBeforeMount, nextTick } from 'vue';
|
|
137
|
+
import { useCoreStore } from '@/stores/core';
|
|
138
|
+
import { useUserStore } from '@/stores/user';
|
|
139
|
+
import { callAdminForthApi, loadFile, applyRegexValidation } from '@/utils';
|
|
140
|
+
import { onBeforeRouteUpdate, useRoute, useRouter } from 'vue-router';
|
|
141
|
+
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
142
|
+
import Button from '@/afcl/Button.vue';
|
|
143
|
+
import Link from '@/afcl/Link.vue';
|
|
144
|
+
import { useI18n } from 'vue-i18n';
|
|
145
|
+
import adminforth from '@/adminforth';
|
|
146
|
+
|
|
147
|
+
const { t } = useI18n();
|
|
148
|
+
|
|
149
|
+
const inProgress = ref(false);
|
|
150
|
+
|
|
151
|
+
const coreStore = useCoreStore();
|
|
152
|
+
const requestSent = ref(false);
|
|
153
|
+
|
|
154
|
+
const emailInput: Ref<HTMLInputElement | null> = ref(null);
|
|
155
|
+
const passwordInput: Ref<HTMLInputElement | null> = ref(null);
|
|
156
|
+
const passwordConfirmationInput: Ref<HTMLInputElement | null> = ref(null);
|
|
157
|
+
|
|
158
|
+
const password = ref("");
|
|
159
|
+
const passwordConfirmation = ref("");
|
|
160
|
+
const unmasked = ref(false);
|
|
161
|
+
const sentToEmail: Ref<string> = ref('');
|
|
162
|
+
|
|
163
|
+
const requestEmailConfirmation = computed(() => route.meta.requestEmailConfirmation);
|
|
164
|
+
const verifyToken = computed(() => route.query.token);
|
|
165
|
+
const isPasswordNeeded = computed(() => !requestEmailConfirmation.value || (requestEmailConfirmation.value && verifyToken.value));
|
|
166
|
+
|
|
167
|
+
const user = useUserStore();
|
|
168
|
+
|
|
169
|
+
const route = useRoute();
|
|
170
|
+
const router = useRouter();
|
|
171
|
+
|
|
172
|
+
function checkPassword() {
|
|
173
|
+
|
|
174
|
+
if (!password.value || !passwordConfirmation.value) {
|
|
175
|
+
return t('Please enter both password and password confirmation');
|
|
176
|
+
}
|
|
177
|
+
if (password.value !== passwordConfirmation.value) {
|
|
178
|
+
return t('Passwords do not match');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (!passwordConstraints.value) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
if (password.value.length < passwordConstraints.value.minLength) {
|
|
185
|
+
return t(`Password must be at least {minLength} characters long`, { minLength: passwordConstraints.value.minLength });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (password.value.length > passwordConstraints.value.maxLength) {
|
|
189
|
+
return t(`Password must be at most {maxLength} characters long`, { maxLength: passwordConstraints.value.maxLength });
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if (passwordConstraints.value.validation) {
|
|
193
|
+
const valError = applyRegexValidation(password.value, passwordConstraints.value.validation);
|
|
194
|
+
if (valError) {
|
|
195
|
+
return valError;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const validationRunning = ref(false);
|
|
203
|
+
|
|
204
|
+
const validationError = computed(() => {
|
|
205
|
+
if (validationRunning.value) {
|
|
206
|
+
return checkPassword();
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
const error: Ref<string | null> = ref(null);
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
const backgroundPosition = computed(() => {
|
|
215
|
+
return coreStore.config?.loginBackgroundPosition || '1/2';
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
const passwordConstraints: Ref<{
|
|
220
|
+
minLength: number;
|
|
221
|
+
maxLength: number;
|
|
222
|
+
validation: string;
|
|
223
|
+
}> = ref({
|
|
224
|
+
minLength: 8,
|
|
225
|
+
maxLength: 100,
|
|
226
|
+
validation: '',
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
// implement something similar to beforeEnter
|
|
230
|
+
// beforeEnter: async (to, from, next) => {
|
|
231
|
+
// if(localStorage.getItem('isAuthorized') === 'true') {
|
|
232
|
+
// // check if url has next=... and redirect to it
|
|
233
|
+
// console.log('to.query', to.query)
|
|
234
|
+
// if (to.query.next) {
|
|
235
|
+
// next(to.query.next.toString())
|
|
236
|
+
// } else {
|
|
237
|
+
// next({name: 'home'});
|
|
238
|
+
// }
|
|
239
|
+
// } else {
|
|
240
|
+
// next()
|
|
241
|
+
// }
|
|
242
|
+
// }
|
|
243
|
+
|
|
244
|
+
onBeforeMount(() => {
|
|
245
|
+
// console.log('⛔ SignUp Page. Before Mount: ', route)
|
|
246
|
+
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
247
|
+
// if route has next param, redirect
|
|
248
|
+
coreStore.fetchMenuAndResource();
|
|
249
|
+
if (route.query.next) {
|
|
250
|
+
router.push(route.query.next.toString());
|
|
251
|
+
} else {
|
|
252
|
+
router.push({ name: 'home' });
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
onMounted(async () => {
|
|
258
|
+
emailInput.value?.focus();
|
|
259
|
+
await coreStore.getPublicConfig();
|
|
260
|
+
|
|
261
|
+
await nextTick();
|
|
262
|
+
await router.isReady();
|
|
263
|
+
|
|
264
|
+
// getPasswordConstraints
|
|
265
|
+
console.log('⛔ SignUp Page. Before Mount: ', route.meta)
|
|
266
|
+
passwordConstraints.value = await callAdminForthApi({
|
|
267
|
+
path: `/plugin/${route.meta.pluginInstanceId}/password-constraints`,
|
|
268
|
+
method: 'GET',
|
|
269
|
+
});
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
// onMounted(async () => {
|
|
273
|
+
// });
|
|
274
|
+
|
|
275
|
+
async function doSignup() {
|
|
276
|
+
error.value = null;
|
|
277
|
+
const email = emailInput.value!.value;
|
|
278
|
+
if (!email) {
|
|
279
|
+
error.value = t('Please enter your email');
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!requestEmailConfirmation.value && checkPassword()) {
|
|
283
|
+
validationRunning.value = true;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
inProgress.value = true;
|
|
288
|
+
const resp = await callAdminForthApi({
|
|
289
|
+
path: `/plugin/${route.meta.pluginInstanceId}/signup`,
|
|
290
|
+
method: 'POST',
|
|
291
|
+
body: {
|
|
292
|
+
email,
|
|
293
|
+
url: window.location.origin + window.location.pathname,
|
|
294
|
+
...(!requestEmailConfirmation.value ? {password: password.value} : {}),
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
inProgress.value = false;
|
|
298
|
+
if (resp.error) {
|
|
299
|
+
error.value = resp.error;
|
|
300
|
+
} else {
|
|
301
|
+
error.value = null;
|
|
302
|
+
requestSent.value = true;
|
|
303
|
+
sentToEmail.value = email;
|
|
304
|
+
if (resp.redirectTo && !requestEmailConfirmation.value) {
|
|
305
|
+
router.push(resp.redirectTo);
|
|
306
|
+
} else if (!requestEmailConfirmation.value) {
|
|
307
|
+
error.value = null;
|
|
308
|
+
await user.finishLogin();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const signupAfterEmailConfirmation = async () => {
|
|
314
|
+
if (checkPassword()) {
|
|
315
|
+
validationRunning.value = true;
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const resp = await callAdminForthApi({
|
|
319
|
+
path: `/plugin/${route.meta.pluginInstanceId}/complete-verified-signup`,
|
|
320
|
+
method: 'POST',
|
|
321
|
+
body: {
|
|
322
|
+
token: verifyToken.value,
|
|
323
|
+
password: password.value,
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
if (resp.error) {
|
|
327
|
+
adminforth.alert({
|
|
328
|
+
message: t(`Error fetching data: {error}`, { error: resp.error }),
|
|
329
|
+
variant: 'danger',
|
|
330
|
+
});
|
|
331
|
+
} else if (resp.redirectTo) {
|
|
332
|
+
router.push(resp.redirectTo);
|
|
333
|
+
} else {
|
|
334
|
+
await user.finishLogin();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<p class="text-gray-500 dark:text-gray-400 font-sm text-left mt-3">
|
|
3
|
+
{{$t('Have no account?')}}
|
|
4
|
+
<Link :to="`/signup${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">
|
|
5
|
+
{{$t('sign up now')}}
|
|
6
|
+
</Link>
|
|
7
|
+
</p>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup>
|
|
11
|
+
import Link from '@/afcl/Link.vue';
|
|
12
|
+
import { useRoute } from 'vue-router';
|
|
13
|
+
|
|
14
|
+
const route = useRoute();
|
|
15
|
+
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".", // This should point to your project root
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*": [
|
|
6
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
+
"../../../spa/src/*"
|
|
8
|
+
],
|
|
9
|
+
"*": [
|
|
10
|
+
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
+
"../../../spa/node_modules/*"
|
|
12
|
+
],
|
|
13
|
+
"@@/*": [
|
|
14
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
|
+
"."
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|