@adminforth/open-signup 1.0.7 → 1.0.9
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/Changelog.md +8 -0
- package/custom/SignupPage.vue +4 -4
- package/custom/SignupUnderLogin.vue +1 -1
- package/dist/custom/SignupPage.vue +4 -4
- package/dist/custom/SignupUnderLogin.vue +1 -1
- package/dist/index.js +5 -2
- package/index.ts +6 -2
- package/package.json +1 -1
package/Changelog.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
## [v1.0.9]
|
|
1
2
|
|
|
3
|
+
# Fixed
|
|
4
|
+
- when user created normalize email to lowercase. This is not needed when right email validator is set on email field because
|
|
5
|
+
it will not allow to create such email, but if user forgot to set it it might save situation
|
|
2
6
|
|
|
7
|
+
## [v1.0.8]
|
|
8
|
+
|
|
9
|
+
# Fixed
|
|
10
|
+
- ensure next params keeps be encoded as URI between moving to/from login page
|
|
3
11
|
|
|
4
12
|
## [v1.0.7]
|
|
5
13
|
|
package/custom/SignupPage.vue
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<div class="p-4 md:p-5">
|
|
39
39
|
<form v-if="!requestSent" class="space-y-4" role="alert" @submit.prevent>
|
|
40
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')}}</label>
|
|
41
|
+
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your email address')}}</label>
|
|
42
42
|
<input type="email" name="email" id="email"
|
|
43
43
|
tabindex="1"
|
|
44
44
|
autocomplete="username"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
/>
|
|
51
51
|
</div>
|
|
52
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('
|
|
53
|
+
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your password')}}</label>
|
|
54
54
|
<input
|
|
55
55
|
tabindex="2"
|
|
56
56
|
autocomplete="new-password"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
</div>
|
|
75
75
|
|
|
76
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
|
|
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
78
|
<input
|
|
79
79
|
ref="passwordConfirmationInput"
|
|
80
80
|
autocomplete="new-password"
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
{{$t('Please check your email at')}} {{ sentToEmail }} {{$t('to confirm your email address.')}}
|
|
122
122
|
</div>
|
|
123
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=${route.query.next}` : ''}`">{{ $t('login here') }}</Link>
|
|
124
|
+
{{$t('Already have an account?')}} <Link :to="`/login${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">{{ $t('login here') }}</Link>
|
|
125
125
|
</p>
|
|
126
126
|
</div>
|
|
127
127
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<p class="text-gray-500 dark:text-gray-400 font-sm text-left mt-3">
|
|
3
3
|
{{$t('Have no account?')}}
|
|
4
|
-
<Link :to="`/signup${route.query.next ? `?next=${route.query.next}` : ''}`">
|
|
4
|
+
<Link :to="`/signup${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">
|
|
5
5
|
{{$t('sign up now')}}
|
|
6
6
|
</Link>
|
|
7
7
|
</p>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<div class="p-4 md:p-5">
|
|
39
39
|
<form v-if="!requestSent" class="space-y-4" role="alert" @submit.prevent>
|
|
40
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')}}</label>
|
|
41
|
+
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your email address')}}</label>
|
|
42
42
|
<input type="email" name="email" id="email"
|
|
43
43
|
tabindex="1"
|
|
44
44
|
autocomplete="username"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
/>
|
|
51
51
|
</div>
|
|
52
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('
|
|
53
|
+
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">{{$t('Your password')}}</label>
|
|
54
54
|
<input
|
|
55
55
|
tabindex="2"
|
|
56
56
|
autocomplete="new-password"
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
</div>
|
|
75
75
|
|
|
76
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
|
|
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
78
|
<input
|
|
79
79
|
ref="passwordConfirmationInput"
|
|
80
80
|
autocomplete="new-password"
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
{{$t('Please check your email at')}} {{ sentToEmail }} {{$t('to confirm your email address.')}}
|
|
122
122
|
</div>
|
|
123
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=${route.query.next}` : ''}`">{{ $t('login here') }}</Link>
|
|
124
|
+
{{$t('Already have an account?')}} <Link :to="`/login${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">{{ $t('login here') }}</Link>
|
|
125
125
|
</p>
|
|
126
126
|
</div>
|
|
127
127
|
</div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<p class="text-gray-500 dark:text-gray-400 font-sm text-left mt-3">
|
|
3
3
|
{{$t('Have no account?')}}
|
|
4
|
-
<Link :to="`/signup${route.query.next ? `?next=${route.query.next}` : ''}`">
|
|
4
|
+
<Link :to="`/signup${route.query.next ? `?next=${encodeURIComponent(route.query.next)}` : ''}`">
|
|
5
5
|
{{$t('sign up now')}}
|
|
6
6
|
</Link>
|
|
7
7
|
</p>
|
package/dist/index.js
CHANGED
|
@@ -198,14 +198,17 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
+
// This is not needed when right email validator is set on email field because
|
|
202
|
+
// it will not allow to create such email, but if user forgot to set it it might save situation
|
|
203
|
+
const normalizedEmail = email.toLowerCase(); // normalize email
|
|
201
204
|
// first check again if email already exists
|
|
202
|
-
const existingUser = yield this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.emailField.name,
|
|
205
|
+
const existingUser = yield this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.emailField.name, normalizedEmail));
|
|
203
206
|
if ((!this.options.confirmEmails && existingUser) || (this.options.confirmEmails && (existingUser === null || existingUser === void 0 ? void 0 : existingUser[this.emailConfirmedField.name]))) {
|
|
204
207
|
return { error: tr('Email already exists', 'opensignup'), ok: false };
|
|
205
208
|
}
|
|
206
209
|
// create user
|
|
207
210
|
if (!existingUser) {
|
|
208
|
-
const created = yield this.adminforth.resource(this.authResource.resourceId).create(Object.assign(Object.assign(Object.assign({}, (this.options.defaultFieldValues || {})), (this.options.confirmEmails ? { [this.options.confirmEmails.emailConfirmedField]: false } : {})), { [this.emailField.name]:
|
|
211
|
+
const created = yield this.adminforth.resource(this.authResource.resourceId).create(Object.assign(Object.assign(Object.assign({}, (this.options.defaultFieldValues || {})), (this.options.confirmEmails ? { [this.options.confirmEmails.emailConfirmedField]: false } : {})), { [this.emailField.name]: normalizedEmail, [this.options.passwordHashField]: password ? yield AdminForth.Utils.generatePasswordHash(password) : '' }));
|
|
209
212
|
}
|
|
210
213
|
if (!this.options.confirmEmails) {
|
|
211
214
|
const resp = yield this.doLogin(email, response, { body, headers, query, cookies });
|
package/index.ts
CHANGED
|
@@ -227,9 +227,13 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
+
|
|
231
|
+
// This is not needed when right email validator is set on email field because
|
|
232
|
+
// it will not allow to create such email, but if user forgot to set it it might save situation
|
|
233
|
+
const normalizedEmail = email.toLowerCase(); // normalize email
|
|
230
234
|
|
|
231
235
|
// first check again if email already exists
|
|
232
|
-
const existingUser = await this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.emailField.name,
|
|
236
|
+
const existingUser = await this.adminforth.resource(this.authResource.resourceId).get(Filters.EQ(this.emailField.name, normalizedEmail));
|
|
233
237
|
if ((!this.options.confirmEmails && existingUser) || (this.options.confirmEmails && existingUser?.[this.emailConfirmedField.name])) {
|
|
234
238
|
return { error: tr('Email already exists', 'opensignup'), ok: false };
|
|
235
239
|
}
|
|
@@ -239,7 +243,7 @@ export default class OpenSignupPlugin extends AdminForthPlugin {
|
|
|
239
243
|
const created = await this.adminforth.resource(this.authResource.resourceId).create({
|
|
240
244
|
...(this.options.defaultFieldValues || {}),
|
|
241
245
|
...(this.options.confirmEmails ? { [this.options.confirmEmails.emailConfirmedField]: false } : {}),
|
|
242
|
-
[this.emailField.name]:
|
|
246
|
+
[this.emailField.name]: normalizedEmail,
|
|
243
247
|
[this.options.passwordHashField]: password ? await AdminForth.Utils.generatePasswordHash(password) : '',
|
|
244
248
|
});
|
|
245
249
|
}
|