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: 'io.spring.dependency-management'
|
||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
|
|
||||||
application {
|
//application {
|
||||||
mainClassName = 'greenify.server.Application'
|
// mainClassName = 'greenify.server.Application'
|
||||||
}
|
//}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ public class DashBoardController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* method opend addFriend scene.
|
* method opens addFriend scene.
|
||||||
* @throws IOException when file is not found
|
* @throws IOException when file is not found
|
||||||
*/
|
*/
|
||||||
public void openAddFriend() throws IOException {
|
public void openAddFriend() throws IOException {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package greenify.client.controller;
|
|||||||
|
|
||||||
import greenify.client.Application;
|
import greenify.client.Application;
|
||||||
import greenify.client.rest.UserService;
|
import greenify.client.rest.UserService;
|
||||||
|
import greenify.common.ApplicationException;
|
||||||
import javafx.animation.Interpolator;
|
import javafx.animation.Interpolator;
|
||||||
import javafx.animation.KeyFrame;
|
import javafx.animation.KeyFrame;
|
||||||
import javafx.animation.KeyValue;
|
import javafx.animation.KeyValue;
|
||||||
@@ -228,7 +229,14 @@ public class RegisterWindowController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//register the user with the provided username and password
|
//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
|
//close the register window after the user has entered all the credentials
|
||||||
Stage current = (Stage) owner;
|
Stage current = (Stage) owner;
|
||||||
current.close();
|
current.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user