|
|
@@ -16,13 +16,19 @@ public class LoadFixedUser {
|
|
|
@Bean
|
|
|
CommandLineRunner initDatabase(CustomUserRepository repository) {
|
|
|
return args -> {
|
|
|
- CustomUser admin = new CustomUser("admin", "notAnAdmin");
|
|
|
- if (repository.findByUsername("admin") == null) {
|
|
|
- log.info("Preloading " + repository.save(admin));
|
|
|
+ CustomUser admin = repository.findByUsername("admin");
|
|
|
+ if (admin == null) {
|
|
|
+ admin = new CustomUser("admin", "1'mnotAnAdmin.");
|
|
|
+ } else {
|
|
|
+ admin.setPassword("1'mnotAnAdmin.");
|
|
|
}
|
|
|
+ log.info("Preloading " + repository.save(admin));
|
|
|
if (repository.findByUsername("clovis") == null) {
|
|
|
log.info("Preloading " + repository.save(new CustomUser("clovis", "M1m2pBP.")));
|
|
|
}
|
|
|
+ if (repository.findByUsername("marine") == null) {
|
|
|
+ log.info("Preloading " + repository.save(new CustomUser("marine", "BrassDansLaGaronne.M")));
|
|
|
+ }
|
|
|
};
|
|
|
}
|
|
|
}
|