Public Access
feat(registration): no invite code, request text
This commit is contained in:
1 parent
f4e69e1a94
commit
79b086c525
7 files changed
+55
-42
No files matched your search
@@ -13,10 +13,6 @@ const passwordField = z
|
||||
.min(8, 'VALIDATION.PASSWORD_TOO_SHORT')
|
||||
.refine((value) => new TextEncoder().encode(value).length <= 72, 'VALIDATION.PASSWORD_TOO_LONG');
|
||||
|
||||
const inviteCodeField = z
|
||||
.string()
|
||||
.min(1, 'VALIDATION.INVITE_CODE_REQUIRED');
|
||||
|
||||
// Same rule as the Auth service: 3-24 letters, digits, space, _ . - and no space at the ends.
|
||||
// An empty field means "no display name" and is sent as null.
|
||||
const displayNameField = z
|
||||
@@ -33,7 +29,6 @@ export const registrationSchema = z
|
||||
email: emailField,
|
||||
password: passwordField,
|
||||
passwordConfirmation: z.string().min(1, 'VALIDATION.PASSWORD_CONFIRMATION_REQUIRED'),
|
||||
inviteCode: inviteCodeField,
|
||||
displayName: displayNameField,
|
||||
})
|
||||
.refine((d) => d.password === d.passwordConfirmation, {
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('Steam ID', () => {
|
||||
it('is no form field any more: it comes only from "Sign in through Steam"', () => {
|
||||
expect(settingsSchema.parse({...settings(), steamId: '76561198005679788'})).not.toHaveProperty('steamId');
|
||||
expect(registrationSchema.parse({
|
||||
email: 'a@b.de', password: 'password1', passwordConfirmation: 'password1', inviteCode: 'code',
|
||||
email: 'a@b.de', password: 'password1', passwordConfirmation: 'password1',
|
||||
steamId: '76561198005679788',
|
||||
})).not.toHaveProperty('steamId');
|
||||
});
|
||||
@@ -34,7 +34,7 @@ describe('registration password', () => {
|
||||
it('rejects a password over 72 UTF-8 bytes, as Auth does', () => {
|
||||
const password = 'é'.repeat(37);
|
||||
expect(registrationSchema.safeParse({
|
||||
email: 'a@b.de', password, passwordConfirmation: password, inviteCode: 'code',
|
||||
email: 'a@b.de', password, passwordConfirmation: password,
|
||||
}).success).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user