ADD:: Alert for taken username
This commit is contained in:
@@ -18,9 +18,9 @@ apply plugin: 'org.springframework.boot'
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
apply plugin: 'application'
|
||||
|
||||
application {
|
||||
mainClassName = 'greenify.server.Application'
|
||||
}
|
||||
//application {
|
||||
// mainClassName = 'greenify.server.Application'
|
||||
//}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -422,7 +422,7 @@ public class DashBoardController {
|
||||
}
|
||||
|
||||
/**
|
||||
* method opend addFriend scene.
|
||||
* method opens addFriend scene.
|
||||
* @throws IOException when file is not found
|
||||
*/
|
||||
public void openAddFriend() throws IOException {
|
||||
|
||||
@@ -2,6 +2,7 @@ package greenify.client.controller;
|
||||
|
||||
import greenify.client.Application;
|
||||
import greenify.client.rest.UserService;
|
||||
import greenify.common.ApplicationException;
|
||||
import javafx.animation.Interpolator;
|
||||
import javafx.animation.KeyFrame;
|
||||
import javafx.animation.KeyValue;
|
||||
@@ -228,7 +229,14 @@ public class RegisterWindowController {
|
||||
}
|
||||
|
||||
//register the user with the provided username and password
|
||||
userService.registerUser(userNameText.getText(), passwordField.getText());
|
||||
try{
|
||||
userService.registerUser(userNameText.getText(), passwordField.getText());
|
||||
}
|
||||
catch(RuntimeException ex){
|
||||
UserController.AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Password Error!",
|
||||
"This username has already been taken!");
|
||||
return;
|
||||
}
|
||||
//close the register window after the user has entered all the credentials
|
||||
Stage current = (Stage) owner;
|
||||
current.close();
|
||||
|
||||
Reference in New Issue
Block a user