mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 08:46:15 -04:00
fix(Token Generator): multi token, last settings, length input, denied chars
Fix #777, #822 , #797, #466, #806, #1065
This commit is contained in:
parent
a07806cd15
commit
ff57fda388
5 changed files with 270 additions and 179 deletions
|
@ -5,6 +5,7 @@ export function createToken({
|
|||
withLowercase = true,
|
||||
withNumbers = true,
|
||||
withSymbols = false,
|
||||
deniedChars = '',
|
||||
length = 64,
|
||||
alphabet,
|
||||
}: {
|
||||
|
@ -12,6 +13,7 @@ export function createToken({
|
|||
withLowercase?: boolean
|
||||
withNumbers?: boolean
|
||||
withSymbols?: boolean
|
||||
deniedChars?: string
|
||||
length?: number
|
||||
alphabet?: string
|
||||
}) {
|
||||
|
@ -20,7 +22,7 @@ export function createToken({
|
|||
withLowercase ? 'abcdefghijklmopqrstuvwxyz' : '',
|
||||
withNumbers ? '0123456789' : '',
|
||||
withSymbols ? '.,;:!?./-"\'#{([-|\\@)]=}*+' : '',
|
||||
].join(''); ;
|
||||
].filter(c => !(deniedChars?.includes(c))).join(''); ;
|
||||
|
||||
return shuffleString(allAlphabet.repeat(length)).substring(0, length);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue