Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 58ab3b7f authored by Deniro StopCovid's avatar Deniro StopCovid
Browse files

Merge branch 'feat-disable-captcha-validation' into 'develop'

feat: Disable captcha mandatory

See merge request !16
parents 198f9e2f 10c26fd3
No related branches found
No related tags found
1 merge request!16feat: Disable captcha mandatory
......@@ -71,9 +71,10 @@ public class RegisterControllerImpl implements IRegisterController {
@Override
public ResponseEntity<RegisterResponseDto> register(RegisterVo registerVo) throws RobertServerException {
if (StringUtils.isEmpty(registerVo.getCaptcha())) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}
// TODO: Enable this when the capcha becomes
// if (StringUtils.isEmpty(registerVo.getCaptcha())) {
// return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
// }
if (!captchaService.verifyCaptcha(registerVo)) {
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
......
......@@ -126,32 +126,32 @@ public class RegisterControllerWsRestTest {
assertEquals(HttpStatus.METHOD_NOT_ALLOWED, response.getStatusCode());
verify(this.registrationService, times(0)).saveRegistration(ArgumentMatchers.any());
}
@Test
public void testNullCaptcha() {
this.body = RegisterVo.builder().captcha(null).build();
this.requestEntity = new HttpEntity<>(this.body, this.headers);
ResponseEntity<String> response = this.restTemplate.exchange(this.targetUrl.toString(), HttpMethod.POST,
this.requestEntity, String.class);
assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
verify(this.registrationService, times(0)).saveRegistration(ArgumentMatchers.any());
}
@Test
public void testNoCaptcha() {
this.body = RegisterVo.builder().build();
this.requestEntity = new HttpEntity<>(this.body, this.headers);
ResponseEntity<String> response = this.restTemplate.exchange(this.targetUrl.toString(), HttpMethod.POST,
this.requestEntity, String.class);
assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
verify(this.registrationService, times(0)).saveRegistration(ArgumentMatchers.any());
}
// TODO: Uncomment theses tests when the captcha becomes mandatory
// @Test
// public void testNullCaptcha() {
// this.body = RegisterVo.builder().captcha(null).build();
//
// this.requestEntity = new HttpEntity<>(this.body, this.headers);
//
// ResponseEntity<String> response = this.restTemplate.exchange(this.targetUrl.toString(), HttpMethod.POST,
// this.requestEntity, String.class);
//
// assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
// verify(this.registrationService, times(0)).saveRegistration(ArgumentMatchers.any());
// }
//
// @Test
// public void testNoCaptcha() {
// this.body = RegisterVo.builder().build();
//
// this.requestEntity = new HttpEntity<>(this.body, this.headers);
//
// ResponseEntity<String> response = this.restTemplate.exchange(this.targetUrl.toString(), HttpMethod.POST,
// this.requestEntity, String.class);
//
// assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode());
// verify(this.registrationService, times(0)).saveRegistration(ArgumentMatchers.any());
// }
@Test
public void testCaptchaFailure() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment