From 0bc656116ac66b85a778fa30f82ca275418b5e76 Mon Sep 17 00:00:00 2001 From: Maria Flores Garcia Date: Mon, 9 Mar 2020 12:01:17 +0100 Subject: [PATCH] Add create_image.ps1 add script to build app --- Dockerfile | 1 + create_image.ps1 | 5 +++++ daw.webapp12/create_image.ps1 | 5 +++++ daw.webapp12/docker/Web/create_image.ps1 | 5 +++++ .../java/com/daw/webapp12/controller/UserController.java | 3 +++ 5 files changed, 19 insertions(+) create mode 100644 create_image.ps1 create mode 100644 daw.webapp12/create_image.ps1 create mode 100644 daw.webapp12/docker/Web/create_image.ps1 diff --git a/Dockerfile b/Dockerfile index 9dd4212..5efd0b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ FROM openjdk:8-jdk-alpine VOLUME /tmp ARG JAVA_OPTS ENV JAVA_OPTS=$JAVA_OPTS +CMD ["create_image.ps1"] ADD webapp12.jar webapp12.jar EXPOSE 8443 ENTRYPOINT exec java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar webapp12.jar diff --git a/create_image.ps1 b/create_image.ps1 new file mode 100644 index 0000000..87a27a6 --- /dev/null +++ b/create_image.ps1 @@ -0,0 +1,5 @@ +cd ./daw.webapp12 +docker run -imysqlt --rm --name mavenInstalation -v ${PWD}:/src -w /src maven:3.6-jdk-8 mvn clean install +mvn package +Copy-Item './target/daw.webapp12-0.0.1-SNAPSHOT.jar' '../webapp12.jar' +Write-Output 'Compilacion completa completada' \ No newline at end of file diff --git a/daw.webapp12/create_image.ps1 b/daw.webapp12/create_image.ps1 new file mode 100644 index 0000000..9cf242d --- /dev/null +++ b/daw.webapp12/create_image.ps1 @@ -0,0 +1,5 @@ +cd ./daw.webpp12 +docker run -it --rm --name mavenInstalation -v ${PWD}:/src -w /src maven:3.6-jdk-8 mvn clean install +mvn package +Copy-Item './target/daw.webapp12-0.0.1-SNAPSHOT.jar' '../webapp12.jar' +Write-Output 'Instalacion y empaquetado de maven completada' \ No newline at end of file diff --git a/daw.webapp12/docker/Web/create_image.ps1 b/daw.webapp12/docker/Web/create_image.ps1 new file mode 100644 index 0000000..87a27a6 --- /dev/null +++ b/daw.webapp12/docker/Web/create_image.ps1 @@ -0,0 +1,5 @@ +cd ./daw.webapp12 +docker run -imysqlt --rm --name mavenInstalation -v ${PWD}:/src -w /src maven:3.6-jdk-8 mvn clean install +mvn package +Copy-Item './target/daw.webapp12-0.0.1-SNAPSHOT.jar' '../webapp12.jar' +Write-Output 'Compilacion completa completada' \ No newline at end of file diff --git a/daw.webapp12/src/main/java/com/daw/webapp12/controller/UserController.java b/daw.webapp12/src/main/java/com/daw/webapp12/controller/UserController.java index e1e7879..9e19059 100644 --- a/daw.webapp12/src/main/java/com/daw/webapp12/controller/UserController.java +++ b/daw.webapp12/src/main/java/com/daw/webapp12/controller/UserController.java @@ -104,6 +104,9 @@ public String register(Model model) { public String signUp(Model model,@RequestParam String username, HttpServletRequest request, HttpServletResponse response,@RequestParam String email,@RequestParam String password) throws Exception{ String pass = password; Optional u1= userService.findByName(username); + if (username.equals("")||pass.equals("")||email.equals("")){ + return "loginError"; + } Users user = new Users(username, email, password, "ROLE_USER"); if (u1== null){ userService.addUser(user);