From 97313c06bee25a247dd8ac3f3cc95e76d47564f2 Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 03:20:39 -0300 Subject: [PATCH 1/6] . --- src/main/resources/system.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/main/resources/system.properties diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties new file mode 100644 index 0000000..180a273 --- /dev/null +++ b/src/main/resources/system.properties @@ -0,0 +1 @@ +java.runtime.version=11 \ No newline at end of file From 184c75d2c25d0a6555a3a8352905a097610068be Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 03:21:50 -0300 Subject: [PATCH 2/6] . --- pom.xml | 2 +- src/main/resources/system.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 50e8bcf..1610355 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ bubble Demo project for Spring Boot - 11 + 1.8 diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties index 180a273..916c446 100644 --- a/src/main/resources/system.properties +++ b/src/main/resources/system.properties @@ -1 +1 @@ -java.runtime.version=11 \ No newline at end of file +java.runtime.version=1.8 \ No newline at end of file From 917742437e071bf74b01efa7d5650e278fdee23f Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 03:26:52 -0300 Subject: [PATCH 3/6] . --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 1610355..a3210b4 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,11 @@ + + com.heroku.sdk + heroku-maven-plugin + 2.0.8 + org.springframework.boot spring-boot-maven-plugin From ce68c7e6a55a993008667b252d3ecafe883c44cb Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 13:44:15 -0300 Subject: [PATCH 4/6] teste --- pom.xml | 23 ++++++++++++++--------- src/main/resources/application.properties | 18 +++++++----------- src/main/resources/system.properties | 1 - 3 files changed, 21 insertions(+), 21 deletions(-) delete mode 100644 src/main/resources/system.properties diff --git a/pom.xml b/pom.xml index a3210b4..24d4769 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ bubble Demo project for Spring Boot - 1.8 + 11 @@ -45,10 +45,11 @@ org.thymeleaf.extras thymeleaf-extras-springsecurity5 + - mysql - mysql-connector-java - 8.0.26 + com.h2database + h2 + runtime org.projectlombok @@ -75,11 +76,15 @@ - - com.heroku.sdk - heroku-maven-plugin - 2.0.8 - + + org.apache.maven.plugins + maven-compiler-plugin + 2.4 + + 1.8 + 1.8 + + org.springframework.boot spring-boot-maven-plugin diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5c47e14..5297cff 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,14 +1,10 @@ -# database configs -spring.datasource.url=jdbc:mysql://localhost:3306/api?useTimezone=true&serverTimezone=America/Sao_Paulo -spring.datasource.username=root -spring.datasource.password=scope227 -spring.datasource.driverClassName=com.mysql.jdbc.Driver -spring.datasource.testWhileIdle=true -spring.datasource.validationQuery=SELECT 1 -spring.jpa.show-sql=true -spring.jpa.hibernate.ddl-auto=update -spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.driverClassName=org.h2.Driver +spring.datasource.username=sa +spring.datasource.password=password +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console spring.servlet.multipart.max-file-size=10MB spring.servlet.multipart.max-request-size=10MB diff --git a/src/main/resources/system.properties b/src/main/resources/system.properties deleted file mode 100644 index 916c446..0000000 --- a/src/main/resources/system.properties +++ /dev/null @@ -1 +0,0 @@ -java.runtime.version=1.8 \ No newline at end of file From 6c2203445719ef01a05e965343a4053858a30ff9 Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 18:11:45 -0300 Subject: [PATCH 5/6] update --- .../bubble/controller/ConfigController.java | 3 +- .../bubble/controller/LoginController.java | 11 +- .../controller/ajax/AjaxController.java | 8 ++ .../bubble/security/SecurityWebConfig.java | 5 +- .../resources/static/assets/css/custom.css | 12 ++ .../resources/templates/replace/base.html | 116 ++++++++++-------- 6 files changed, 101 insertions(+), 54 deletions(-) diff --git a/src/main/java/com/social/bubble/controller/ConfigController.java b/src/main/java/com/social/bubble/controller/ConfigController.java index 7448c2d..4565328 100644 --- a/src/main/java/com/social/bubble/controller/ConfigController.java +++ b/src/main/java/com/social/bubble/controller/ConfigController.java @@ -73,8 +73,9 @@ public String configContaGet(UsuarioDTOConta usuarioDTO, MultipartFile file){ public String configSenha(String antigaSenha, String novaSenha){ Usuario myUser = principalUserService.get(); + BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); - if(new BCryptPasswordEncoder().matches(myUser.getPassword(), antigaSenha)){ + if(bCryptPasswordEncoder.matches(antigaSenha, myUser.getPassword())){ myUser.setSenha(new BCryptPasswordEncoder(8).encode(novaSenha)); diff --git a/src/main/java/com/social/bubble/controller/LoginController.java b/src/main/java/com/social/bubble/controller/LoginController.java index 0beb7df..f719f8a 100644 --- a/src/main/java/com/social/bubble/controller/LoginController.java +++ b/src/main/java/com/social/bubble/controller/LoginController.java @@ -6,16 +6,21 @@ import org.springframework.web.servlet.ModelAndView; @Controller -@RequestMapping(value = "/login") public class LoginController { //tela de login com validação spring security - @RequestMapping(value = "/", method = RequestMethod.GET) + + @RequestMapping(value = "/login/", method = RequestMethod.GET) public ModelAndView loginGet(){ return new ModelAndView("home/login"); } - @RequestMapping(value = "/", method = RequestMethod.POST) + @RequestMapping(value = "/", method = RequestMethod.GET) + public ModelAndView standard(){ + return new ModelAndView("redirect:/login/"); + } + + @RequestMapping(value = "/login/", method = RequestMethod.POST) public ModelAndView loginPost(){ return new ModelAndView("redirect:/perfil/meuPerfil"); } diff --git a/src/main/java/com/social/bubble/controller/ajax/AjaxController.java b/src/main/java/com/social/bubble/controller/ajax/AjaxController.java index 892cc3a..374b27a 100644 --- a/src/main/java/com/social/bubble/controller/ajax/AjaxController.java +++ b/src/main/java/com/social/bubble/controller/ajax/AjaxController.java @@ -9,6 +9,7 @@ import com.social.bubble.service.UsuarioService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -83,4 +84,11 @@ ModelAndView carregarNumComentarios(@PathVariable("id") long id){ modelAndView.addObject("post", postagemService.findById(id)); return modelAndView; } + + @RequestMapping(value = "/content/alert/{name}/{msg}", method = RequestMethod.GET) + ModelAndView carregarAlert(@PathVariable("name") String name, @PathVariable("msg") String msg){ + ModelAndView modelAndView = new ModelAndView("replace/base :: alert"); + modelAndView.addObject(name, msg); + return modelAndView; + } } diff --git a/src/main/java/com/social/bubble/security/SecurityWebConfig.java b/src/main/java/com/social/bubble/security/SecurityWebConfig.java index 69abe48..eb2e361 100644 --- a/src/main/java/com/social/bubble/security/SecurityWebConfig.java +++ b/src/main/java/com/social/bubble/security/SecurityWebConfig.java @@ -20,7 +20,10 @@ public class SecurityWebConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() - .authorizeRequests().anyRequest().permitAll() + .authorizeRequests().antMatchers("/login/","/cadastro/").permitAll() + .and().authorizeRequests().antMatchers( + "/homePage/**","/perfil/**","/config/**","/bubbleChat/**","/pesquisa/**" + ).authenticated() .and().headers().frameOptions().sameOrigin() .and().formLogin().loginPage("/login/").successForwardUrl("/login/").permitAll() .and().logout().permitAll().logoutRequestMatcher(new AntPathRequestMatcher("/logout")); diff --git a/src/main/resources/static/assets/css/custom.css b/src/main/resources/static/assets/css/custom.css index 44a85ed..06a2142 100644 --- a/src/main/resources/static/assets/css/custom.css +++ b/src/main/resources/static/assets/css/custom.css @@ -58,6 +58,18 @@ margin-top:25px; } +.margin-top-2{ + margin-top:50px; +} + +.margin-top-3{ + margin-top:75px; +} + +.margin-top-4{ + margin-top:100px; +} + .container-img { border: 1px black; width: 100%; diff --git a/src/main/resources/templates/replace/base.html b/src/main/resources/templates/replace/base.html index d1aff3f..bd31b36 100644 --- a/src/main/resources/templates/replace/base.html +++ b/src/main/resources/templates/replace/base.html @@ -55,83 +55,101 @@ -
+
-
-
-
- info_outline +
+
+
+
+
+ info_outline +
+ + Info:
- - Info:
-
-
-
- check +
+
+
+
+
+ check +
+ + Success:
- - Success:
-
-
-
- check +
+
+
+
+
+ check +
+ + Success: Deslogado com sucesso!.
- - Success: Deslogado com sucesso!.
-
-
-
- warning +
+
+
+
+
+ warning +
+ + Warning:
- - Warning:
-
-
-
- warning +
+
+
+
+
+ warning +
+ + Warning: Usuário ou senha incorreta!.
- - Warning: Usuário ou senha incorreta!.
-
-
-
- error_outline +
+
+
+
+
+ error_outline +
+ + Danger:
- - Danger:
From 8de3402bbab81199761aa0bf34259db9bd00dfe6 Mon Sep 17 00:00:00 2001 From: matdashell Date: Sun, 19 Sep 2021 18:33:22 -0300 Subject: [PATCH 6/6] update --- .../resources/templates/home/cadastro.html | 2 +- .../templates/replace/pack-postagem.html | 6 ++--- .../resources/templates/timeline/perfil.html | 24 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/resources/templates/home/cadastro.html b/src/main/resources/templates/home/cadastro.html index c9fefff..10f436c 100644 --- a/src/main/resources/templates/home/cadastro.html +++ b/src/main/resources/templates/home/cadastro.html @@ -97,7 +97,7 @@ add_a_photo
- +
diff --git a/src/main/resources/templates/replace/pack-postagem.html b/src/main/resources/templates/replace/pack-postagem.html index 2c3dd11..6e8d52c 100644 --- a/src/main/resources/templates/replace/pack-postagem.html +++ b/src/main/resources/templates/replace/pack-postagem.html @@ -71,13 +71,13 @@
-
-
+
+
textsms
-