From d0a058e0fbf87af03356dfa67c0e67fabb1c65f9 Mon Sep 17 00:00:00 2001 From: Philippe PITTOLI Date: Wed, 1 May 2024 00:30:49 +0200 Subject: [PATCH] PasswordTooLong --- src/requests/register.cr | 1 + src/responses/errors.cr | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/requests/register.cr b/src/requests/register.cr index cc83c11..ae1c250 100644 --- a/src/requests/register.cr +++ b/src/requests/register.cr @@ -36,6 +36,7 @@ class AuthD::Request # In this case we should not accept its registration. return Response::ErrorPasswordTooShort.new if @password.size < 20 + return Response::ErrorPasswordTooLong.new if @password.size > 100 uid = authd.new_uid password = authd.hash_password @password diff --git a/src/responses/errors.cr b/src/responses/errors.cr index 2cf12c6..dd52e4d 100644 --- a/src/responses/errors.cr +++ b/src/responses/errors.cr @@ -96,4 +96,10 @@ class AuthD::Response end end AuthD.responses << ErrorInvalidRenewKey + + IPC::JSON.message ErrorPasswordTooLong, 35 do + def initialize() + end + end + AuthD.responses << ErrorPasswordTooLong end