mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
feat(shared,phrases-ui): not allow hyphens in username (#1319)
This commit is contained in:
parent
441660716c
commit
5e819665c7
4 changed files with 6 additions and 6 deletions
|
@ -53,8 +53,8 @@ export class LogtoContext {
|
|||
|
||||
public async init() {
|
||||
const account = {
|
||||
username: generatePassword(),
|
||||
password: generateUsername(),
|
||||
username: generateUsername(),
|
||||
password: generatePassword(),
|
||||
};
|
||||
const codeVerifier = generateCodeVerifier();
|
||||
const codeChallenge = await generateCodeChallenge(codeVerifier);
|
||||
|
|
|
@ -6,5 +6,5 @@ export const extractCookie = (response: Response) => {
|
|||
return headers['set-cookie']?.join('; ') ?? '';
|
||||
};
|
||||
|
||||
export const generateUsername = () => `usr-${crypto.randomUUID()}`;
|
||||
export const generatePassword = () => `pwd-${crypto.randomUUID()}`;
|
||||
export const generateUsername = () => `usr_${crypto.randomUUID().replaceAll('-', '_')}`;
|
||||
export const generatePassword = () => `pwd_${crypto.randomUUID()}`;
|
||||
|
|
|
@ -58,7 +58,7 @@ const translation = {
|
|||
password_required: 'Password is required',
|
||||
username_exists: 'Username already exists',
|
||||
username_should_not_start_with_number: 'Username should not start with a number',
|
||||
username_valid_charset: 'Username should only contain letters, numbers, or underscore.',
|
||||
username_valid_charset: 'Username should only contain letters, numbers, or underscores.',
|
||||
invalid_email: 'The email is invalid',
|
||||
invalid_phone: 'The phone number is invalid',
|
||||
password_min_length: 'Password requires a minimum of {{min}} characters',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export const emailRegEx = /^\S+@\S+\.\S+$/;
|
||||
export const phoneRegEx = /^\d+$/;
|
||||
export const usernameRegEx = /^[A-Z_a-z-][\w-]*$/;
|
||||
export const usernameRegEx = /^[A-Z_a-z]\w*$/;
|
||||
export const passwordRegEx = /^.{6,}$/;
|
||||
export const redirectUriRegEx = /^https?:\/\//;
|
||||
export const hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
|
||||
|
|
Loading…
Add table
Reference in a new issue