User registration
2 unresolved threads
2 unresolved threads
Created userService class for registration of new Users.
Merge request reports
Activity
mentioned in commit dbd5ca70
108 if(login.isPresent()) { 109 info = Authentication.setPassword(password); 110 String saltString = info.get(0); 111 String hastString = info.get(1); 112 login.get().setPasswordSalt(saltString); 113 login.get().setHash(hastString); 114 115 save(login.get()); 116 return true; 117 } 118 } 119 catch (IllegalArgumentException e) { 120 e.printStackTrace(); 121 } 122 return false; 123 } Why do you try to get the login, if you are setting the password for the first time? If I understand this correctly you are creating a Login, ie registering a user with password. Therefore you will not find a login and nothing will happen.
All of these methods really belong in the LoginService or UserService respectively because a repository only concerns itself with interacting with the database and not with business logic.
70 ApplicationState.setCurrentUser(user); 71 return true; 72 } 73 return false; 74 } 75 76 /** 77 * Searches for a user by username, checks if the old password matches, sets new password if old is right 78 * 79 * @param username that will be searched for 80 * @param oldPassword that will be compared to database 81 * @param newPassword that will be set 82 * @return 83 */ 84 public boolean changePassword(String username, String oldPassword, String newPassword) { 85 return loginRepository.changePassword(username, oldPassword, newPassword);
Please register or sign in to reply