ADD:: Alert for taken username

This commit is contained in:
Merel Steenbergen
2019-04-03 21:44:50 +02:00
parent a55e4cecef
commit 25a66832a5
3 changed files with 13 additions and 5 deletions

View File

@@ -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()

View File

@@ -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 {

View File

@@ -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();