lib/auth/utils/unsafeCheck
Esta página aún no está disponible en tu idioma.
Classes
Section titled “Classes”CheckIfUnsafe
Section titled “CheckIfUnsafe”Defined in: studiocms/packages/studiocms/src/lib/auth/utils/unsafeCheck.ts:27^
A service class that provides utility functions to check if a value is unsafe, such as being a reserved username or a password.
Remarks
Section titled “Remarks”This service uses logging and effect-based programming to perform the checks.
Example
Section titled “Example”const checkIfUnsafe = CheckIfUnsafe;const isReservedUsername = yield* checkIfUnsafe.username('admin');const isPassword = yield* checkIfUnsafe.password('123456');
Implements
Section titled “Implements”Extends
Section titled “Extends”any
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CheckIfUnsafe(): CheckIfUnsafe
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Effect.Service<CheckIfUnsafe>()( 'studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe', { effect: genLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.effect')(function () { / Checks if a value is a reserved username
@param value - The value to check @returns An object containing functions to check if the value is a reserved username or password / const username = (val: string) => pipeLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.username')( Effect.try({ try: () => usernameList.includes(val), catch: (cause) => new CheckIfUnsafeError({ message: An unknown Error occurred when checking the username list: ${cause}, }), }) );
/ Checks if a value is a password
@param value - The value to check @returns An object containing functions to check if the value is a reserved username or password / const password = (val: string) => pipeLogger('studiocms/lib/auth/utils/unsafeCheck/CheckIfUnsafe.password')( Effect.try({ try: () => passwordList.includes(val), catch: (cause) => new CheckIfUnsafeError({ message: An unknown Error occurred when checking the password list: ${cause}, }), }) );
return { username, password, }; }), }).constructor
CheckIfUnsafeError
Section titled “CheckIfUnsafeError”Defined in: studiocms/packages/studiocms/src/lib/auth/utils/unsafeCheck.ts:6^
Extends
Section titled “Extends”any
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CheckIfUnsafeError(): CheckIfUnsafeError
Returns
Section titled “Returns”Inherited from
Section titled “Inherited from”Data.TaggedError('CheckIfUnsafeError')<{ message: string;}>.constructor