Changeset 702ca77 for springapp/src/main
- Timestamp:
- 08/19/22 19:10:24 (2 years ago)
- Branches:
- main
- Children:
- 6221ab6
- Parents:
- 6eba109
- Location:
- springapp/src/main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
springapp/src/main/java/mk/profesori/springapp/Controller/PublicController.java
r6eba109 r702ca77 23 23 @RestController 24 24 @RequestMapping("/public") 25 @CrossOrigin(origins = { "http://192.168.0.1 8:3000", "http://192.168.0.24:3000" })25 @CrossOrigin(origins = { "http://192.168.0.17:3000", "http://192.168.0.24:3000" }) 26 26 public class PublicController { 27 27 -
springapp/src/main/java/mk/profesori/springapp/Controller/SecureController.java
r6eba109 r702ca77 25 25 @RestController 26 26 @RequestMapping("/secure") 27 @CrossOrigin(origins = { "http://192.168.0.1 8:3000", "http://192.168.0.24:3000" })27 @CrossOrigin(origins = { "http://192.168.0.17:3000", "http://192.168.0.24:3000" }) 28 28 public class SecureController { 29 29 … … 60 60 } 61 61 62 @RequestMapping(value = "/ user", method = RequestMethod.GET)62 @RequestMapping(value = "/currentUser", method = RequestMethod.GET) 63 63 public UserDetails getUserDetails(@CurrentSecurityContext SecurityContext context) { 64 64 -
springapp/src/main/java/mk/profesori/springapp/Model/CustomUserDetails.java
r6eba109 r702ca77 54 54 @OneToMany(mappedBy = "author", cascade = CascadeType.ALL) 55 55 private Set<Post> authoredPosts = new HashSet<>(); 56 private Integer karma; 56 57 57 58 public CustomUserDetails(String fullName, String username, String email, String password, UserRole userRole) { … … 103 104 } 104 105 106 public Integer getKarma() { 107 Integer karma = 0; 108 for (Post post : this.authoredPosts) { 109 karma += post.getUpvoteCount() - post.getDownvoteCount(); 110 } 111 return karma; 112 } 113 105 114 } -
springapp/src/main/java/mk/profesori/springapp/Security/SecurityConfiguration.java
r6eba109 r702ca77 37 37 @Override 38 38 public void addCorsMappings(CorsRegistry registry) { 39 registry.addMapping("/**").allowedOrigins("http://192.168.0.1 8:3000", "http://192.168.0.24:3000")39 registry.addMapping("/**").allowedOrigins("http://192.168.0.17:3000", "http://192.168.0.24:3000") 40 40 .allowCredentials(true); 41 41 } -
springapp/src/main/java/mk/profesori/springapp/Service/RegistrationService.java
r6eba109 r702ca77 45 45 String tokenToResend = customUserDetailsService 46 46 .createToken(userRepository.findByEmail(request.getEmail()).get()); 47 String link = "http://192.168.0.1 8:8080/registration/confirm?token=" + tokenToResend;47 String link = "http://192.168.0.17:8080/registration/confirm?token=" + tokenToResend; 48 48 emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link)); 49 49 return tokenToResend; … … 66 66 UserRole.REGULAR)); 67 67 68 String link = "http://192.168.0.1 8:8080/registration/confirm?token=" + token;68 String link = "http://192.168.0.17:8080/registration/confirm?token=" + token; 69 69 70 70 emailSender.send(request.getEmail(), emailSender.buildEmail(request.getUsername(), link)); -
springapp/src/main/resources/application.properties
r6eba109 r702ca77 7 7 spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect 8 8 spring.jpa.properties.hibernate.format_sql=true 9 server.address=192.168.0.1 89 server.address=192.168.0.17 10 10 spring.mail.host=192.168.0.24 11 11 spring.mail.username=mailuser
Note:
See TracChangeset
for help on using the changeset viewer.