保誠-保戶業務員媒合平台
wayne
2021-11-29 83fdf8582cd37b0603dba3f4d0a869453722e292
pamapi/src/main/java/com/pollex/pam/web/rest/OtpResource.java
@@ -57,10 +57,10 @@
    @Autowired
    CustomerService customerService;
    @Autowired
    OtpUtilService otpUtilService;
    @Autowired
    CustomerRepository customerRepository;
@@ -83,16 +83,16 @@
    @PostMapping("/verify")
    public ResponseEntity<UserJWTController.JWTToken> verifyOtp(@RequestBody VerifyOtpVM verifyOtpParam) {
       otpUtilService.verifyOtp(verifyOtpParam.getIndexKey(), verifyOtpParam.getOtpCode());
       otpUtilService.verifyOtp(verifyOtpParam);
       Customer customer = customerRepository
                      .findOneByEmailEqualsOrPhoneEquals(verifyOtpParam.getAccount())
                      .orElse(null);
       if (customer == null) {
          return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
       }
       String jwt = customerAuthService.authorize(customer, verifyOtpParam.getIndexKey(), verifyOtpParam.getOtpCode());
        HttpHeaders httpHeaders = new HttpHeaders();
        httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer" + jwt);
@@ -112,6 +112,6 @@
        httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer" + jwt);
        return new ResponseEntity<>(new UserJWTController.JWTToken(jwt), httpHeaders, HttpStatus.OK);
    }
}