| | |
| | | import com.pollex.pam.business.service.ConsultantService; |
| | | import com.pollex.pam.security.jwt.JWTFilter; |
| | | import com.pollex.pam.security.jwt.TokenProvider; |
| | | |
| | | import io.undertow.util.BadRequestException; |
| | | |
| | | import com.pollex.pam.business.security.token.EServiceAuthenticationToken; |
| | | import com.pollex.pam.business.web.errors.OtpLoginFailException; |
| | | import com.pollex.pam.business.web.vm.EServiceLoginVM; |
| | | |
| | | import org.slf4j.Logger; |
| | |
| | | public ResponseEntity<UserJWTController.JWTToken> authorize( |
| | | @RequestBody EServiceLoginVM eServiceLoginVM |
| | | , HttpServletResponse response, HttpServletRequest request, |
| | | @PathVariable String imgCode) { |
| | | log.debug("imgCode:::::::"+imgCode); |
| | | @PathVariable String imgCode) throws BadRequestException { |
| | | HttpSession session = request.getSession(); |
| | | String sessionImpCode = (String) session.getAttribute("img_code"); |
| | | |
| | | if (!StringUtils.hasText(sessionImpCode) |
| | | || !StringUtils.hasText(imgCode)) { |
| | | return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build(); |
| | | throw new OtpLoginFailException("驗證碼輸入錯誤"); |
| | | } |
| | | |
| | | if(!imgCode.equals(sessionImpCode)) { |
| | | return ResponseEntity.status(HttpStatus.BAD_REQUEST).build(); |
| | | throw new OtpLoginFailException("驗證碼輸入錯誤"); |
| | | } |
| | | |
| | | |