Compare commits
No commits in common. "f40eb6544dd695e0aa703f7854fab8a8dfe1998c" and "4dd2c8a218dc65d597343fe23d4725b5082ae1d3" have entirely different histories.
f40eb6544d
...
4dd2c8a218
src/main/java/se/su/dsv/seshat
@ -25,7 +25,7 @@ public class AppUser {
|
||||
@Column(nullable = false, unique = true)
|
||||
private String username;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Column(nullable = false, unique = true)
|
||||
private String email;
|
||||
|
||||
@Column(nullable = false)
|
||||
|
@ -17,6 +17,9 @@ public class UserService {
|
||||
if (appUserRepository.existsByUsername(username)) {
|
||||
throw new IllegalArgumentException("Username already exists");
|
||||
}
|
||||
if (appUserRepository.existsByEmail(email)) {
|
||||
throw new IllegalArgumentException("Email already exists");
|
||||
}
|
||||
|
||||
AppUser newUser = new AppUser(username, email, "USER");
|
||||
appUserRepository.save(newUser);
|
||||
|
Loading…
x
Reference in New Issue
Block a user