From 3bde666802cbe031a3e39f6ab05369229296214f Mon Sep 17 00:00:00 2001 From: Selim Eser <2211482@stud.hs-mannheim.de> Date: Fri, 14 Jun 2024 21:07:31 +0200 Subject: [PATCH] change_user_details method username change logic fixed --- src/main/java/de/hs_mannheim/domain/System.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/hs_mannheim/domain/System.java b/src/main/java/de/hs_mannheim/domain/System.java index 9e6f097..a4aca0f 100644 --- a/src/main/java/de/hs_mannheim/domain/System.java +++ b/src/main/java/de/hs_mannheim/domain/System.java @@ -180,10 +180,12 @@ public class System { if(username.equals("")||hometown.equals("")||zip.equals("")) return false; - for(User user: this.all_user) - if(user.getUsername().equals(username)) - return false; - + if(!current_user.getUsername().equals(username)){ + for(User user: this.all_user) + if(user.getUsername().equals(username)) + return false; + } + ArrayList mem = search(zip); boolean bool = false; @@ -191,7 +193,7 @@ public class System { if(line.split(";")[1].equals(hometown)) { bool = true; break; - } + } if(!bool) return false;