Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stg #3

Merged
merged 7 commits into from
Apr 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,15 @@ public ResponseEntity<JSONObject> signup(@RequestBody UserDTO userDTO) {
return new ResponseEntity<>(result, HttpStatus.OK);
}


@PostMapping("/api/profile")
public ResponseEntity<UserDTO> profile(@RequestBody UserDTO userDTO) {
log.info(" ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ profile controller ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ");
log.info("userDTO: " + userDTO);

UserDTO result = userService.profile(userDTO.getEmail());

log.info("result: " + result);

return new ResponseEntity<>(result, HttpStatus.OK);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.weather.user.repository;

import com.weather.user.entity.MailCode;
import com.weather.user.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res
boolean checkAuthHeader = checkAuthHeader(request);

if(checkAuthHeader) {
log.info("api check success");
filterChain.doFilter(request, response);
} else {
log.info("api check fail");
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
response.setContentType("application/json;charset=utf-8");
JSONObject json = new JSONObject();
Expand All @@ -53,8 +55,10 @@ public void doFilterInternal(HttpServletRequest request, HttpServletResponse res
out.print(json);
}
}

filterChain.doFilter(request, response);
else {
log.info("api check filter done");
filterChain.doFilter(request, response);
}
}

private boolean checkAuthHeader(HttpServletRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public UserDTO googleUserCheck(GoogleUserDTO googleUserDTO) throws Exception{

@Override
public UserDTO googleUserAdditional(UserDTO userDTO) throws Exception{
log.info("ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ");
log.info("ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ");
Optional<User> optionalUser = userRepository.findByEmail(userDTO.getEmail(), true);

if(optionalUser.isPresent()) {
Expand Down
Loading