CHORE: change random username to be <Adj><Animal><3*[0-9]>

This commit is contained in:
padreug 2025-09-04 11:27:16 +02:00
parent 22d4d7120d
commit c082cae156

View file

@ -1,5 +1,5 @@
import { ref } from 'vue' import { ref } from 'vue'
import { uniqueNamesGenerator, names, colors, animals } from 'unique-names-generator' import { uniqueNamesGenerator, NumberDictionary, adjectives, animals } from 'unique-names-generator'
export interface GeneratedCredentials { export interface GeneratedCredentials {
username: string username: string
@ -25,13 +25,14 @@ export function useDemoAccountGenerator() {
// Generate unique username and random password // Generate unique username and random password
function generateCredentials(): GeneratedCredentials { function generateCredentials(): GeneratedCredentials {
// Use only 2 dictionaries to keep username shorter // Use only 2 dictionaries to keep username shorter
const numberDictionary = NumberDictionary.generate({ min: 100, max: 999 });
const username = uniqueNamesGenerator({ const username = uniqueNamesGenerator({
dictionaries: [names, colors], dictionaries: [adjectives, animals, numberDictionary],
separator: '_', separator: '',
length: 2, length: 3,
style: 'lowerCase' style: 'capital'
}) })
const password = generateRandomPassword() const password = generateRandomPassword()
const email = `${username}@demo.local` const email = `${username}@demo.local`
return { username, password, email } return { username, password, email }