From 94626cb4329db883d8dabe7baf5db94fa9cffe61 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Sun, 22 Sep 2024 21:23:48 -0300 Subject: [PATCH] fix: password validator --- database/schedule.sql | 21 ------------------- .../infra/contexts/user/AuthUtils.java | 4 ++-- 2 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 database/schedule.sql diff --git a/database/schedule.sql b/database/schedule.sql deleted file mode 100644 index 04ca170..0000000 --- a/database/schedule.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE OR REPLACE FUNCTION delete_inactive_users() - RETURNS void AS $$ -BEGIN - DELETE FROM users - WHERE active = FALSE - AND id IN ( - - SELECT user_id - FROM upsert_emails - WHERE request_date < NOW() - INTERVAL '4 days' - ); -END; -$$ LANGUAGE plpgsql; - -BEGIN; -SELECT delete_inactive_users(); - -SELECT * FROM users; -SELECT * FROM upsert_emails; -ROLLBACK; - diff --git a/infrastructure/src/main/java/br/com/ifsp/tickets/infra/contexts/user/AuthUtils.java b/infrastructure/src/main/java/br/com/ifsp/tickets/infra/contexts/user/AuthUtils.java index e942eb7..71077fe 100644 --- a/infrastructure/src/main/java/br/com/ifsp/tickets/infra/contexts/user/AuthUtils.java +++ b/infrastructure/src/main/java/br/com/ifsp/tickets/infra/contexts/user/AuthUtils.java @@ -24,10 +24,10 @@ public class AuthUtils implements IAuthUtils { - private static final CharacterRule LOWERCASE = new CharacterRule(EnglishCharacterData.LowerCase, 4); + private static final CharacterRule LOWERCASE = new CharacterRule(EnglishCharacterData.LowerCase, 1); private static final CharacterRule UPPERCASE = new CharacterRule(EnglishCharacterData.UpperCase, 1); private static final CharacterRule NUMBER = new CharacterRule(EnglishCharacterData.Digit, 1); - private static final LengthRule LENGTH_RULE = new LengthRule(8, Integer.MAX_VALUE); + private static final LengthRule LENGTH_RULE = new LengthRule(6, 16); private final PasswordValidator passwordValidator = new PasswordValidator(LENGTH_RULE, NUMBER, UPPERCASE, LOWERCASE); private final String secretKey;