mirror of
https://github.com/rikkaneko/paste.git
synced 2025-06-06 00:25:38 +00:00
Update password rules and error message
Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
parent
8704a9161e
commit
d2a1dd13b8
2 changed files with 4 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue