Skip to content

Commit e23eaf4

Browse files
committed
Password Length Requirement
Password length requirement metot has been created. Now passwords must be have at least eight character.
1 parent 851af2e commit e23eaf4

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Codes/Library.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@ public User login(String username, String password) {
3737
return null;
3838
}
3939

40+
public boolean isAllowedPassword(String password) {
41+
42+
if (password.length() < 8) {
43+
return false;
44+
}
45+
46+
return true;
47+
}
48+
4049
public ArrayList<User> getUsers() {
4150
return users;
4251
}

Codes/MainLibrary.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ else if (secenek == 2) { //register
3535
System.out.println("Şifre Belirleyiniz: ");
3636
String sifre = input.nextLine();
3737

38+
boolean isCorrectPassword = library.isAllowedPassword(sifre);
39+
40+
while (!isCorrectPassword) {
41+
System.out.println("Şifreniz en az 8 karakter uzunluğunda olmalıdır.");
42+
System.out.println("Tekrar şifre giriniz: ");
43+
sifre = input.nextLine();
44+
45+
isCorrectPassword = library.isAllowedPassword(sifre);
46+
}
47+
3848
System.out.println("Aynı şifreyi tekrar giriniz: ");
3949
String tekrarSifre = input.nextLine();
4050

0 commit comments

Comments
 (0)