Skip to content

Commit

Permalink
4944040
Browse files Browse the repository at this point in the history
  • Loading branch information
YarikNarozhnyi committed Nov 20, 2024
1 parent 34c1ab9 commit 647f1c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/core/basesyntax/PasswordValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
public class PasswordValidator {
public void validate(String password, String repeatPassword)
throws PasswordValidationException {
if (password.length() < 10 || repeatPassword.length() < 10
|| password == null || repeatPassword == null) {
throw new PasswordValidationException("Wrong passwords");
if (password == null || repeatPassword == null) {
throw new PasswordValidationException("Паролі не можуть бути null");
}
if (password.length() < 10 || repeatPassword.length() < 10) {
throw new PasswordValidationException("Паролі повинні містити щонайменше 10 символів");
}
if (password.equals(repeatPassword) == false) {
throw new PasswordValidationException("Wrong passwords");
throw new PasswordValidationException("Паролі не співпадають");
}
}
}

0 comments on commit 647f1c4

Please sign in to comment.