diff --git a/src/index.ts b/src/index.ts index 2ea23cd..d585c72 100644 --- a/src/index.ts +++ b/src/index.ts @@ -191,12 +191,9 @@ router.post('/', async (request, env, ctx) => { // Check password rules if (password && !check_password_rules(password)) { - return new Response( - 'Invalid password. ' + 'Password must contain alphabets and digits only, and has a length of 4 or more.', - { - status: 422, - } - ); + return new Response('Password can only contain alphabets and digits only.', { + status: 422, + }); } // Check request.body size <= 25MB diff --git a/src/utils.ts b/src/utils.ts index 52c869d..7a7d1a4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -141,7 +141,7 @@ export async function get_paste_info( }); } export function check_password_rules(password: string): boolean { - return password.match('^[A-z0-9]{4,}$') !== null; + return password.match('^[A-z0-9]{1,}$') !== null; } // Extract username and password from Basic Authorization header export function get_basic_auth(headers: Headers): [string, string] | null {