Compare commits

..

No commits in common. "5cdab5b434cc6763785c3f7e44019dd20f5216ce" and "43c967638b12ad85bd3920a152f782d301783be4" have entirely different histories.

View File

@ -83,27 +83,6 @@ public class UserController {
@RequestParam String login, @RequestParam String login,
@RequestParam String password @RequestParam String password
) { ) {
if(userRepository.findAllUsernames().length == 0){
byte[] salt = Hasher.GenerateSalt();
byte[] hash;
try {
hash = Hasher.HashPassword(password, salt);
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
e.printStackTrace();
return new ResponseEntity<>("Fehler beim hashen", HttpStatus.INTERNAL_SERVER_ERROR);
}
User user = new User();
user.setName("Admin");
user.setForename(login);
user.setLogin(login);
user.setPassword(hash);
user.setSalt(salt);
user.setToken("");
user.setAdmin(true);
userRepository.save(user);
}
System.out.println(login + " tries to login."); System.out.println(login + " tries to login.");
User user = userRepository.findByLogin(login); User user = userRepository.findByLogin(login);
if (user == null) { if (user == null) {