Fixed structure of UI, Added some logic to Auth
This commit is contained in:
@@ -15,10 +15,7 @@ public class UserService {
|
||||
|
||||
public Optional<User> login(String username, String password) {
|
||||
try {
|
||||
|
||||
|
||||
|
||||
return Optional.empty();
|
||||
return userRepository.getUser(username, password);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
return Optional.empty();
|
||||
@@ -27,6 +24,10 @@ public class UserService {
|
||||
|
||||
public Optional<User> register(String username, String email, String password) {
|
||||
try {
|
||||
if (userRepository.userExists(username)) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return userRepository.saveUser(username, email, password);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user