Skip to content

Commit

Permalink
prioriza a validação do captcha antes das validações dos dados de log…
Browse files Browse the repository at this point in the history
…in/cadastro (Ref.: #68)
  • Loading branch information
Raul-vlb committed Sep 15, 2023
1 parent 1c4074c commit 6eab0e1
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,10 @@ function validateRegisterFields() {
// validate captcha
if (!$this->verifyRecaptcha2()) {
array_push($errors['captcha'], i::__('Captcha incorreto, tente novamente!', 'multipleLocal'));
$hasErrors = true;
return [
'success' => false,
'errors' => $errors
];
}

// validates cpf only if login by cpf is enabled
Expand Down Expand Up @@ -729,16 +732,19 @@ function recover() {
'sendEmail' => []
];

if (!$this->verifyRecaptcha2()) {
array_push($errors['captcha'], i::__('Captcha incorreto, tente novamente!', 'multipleLocal'));
return [
'success' => false,
'errors' => $errors
];
}

if (!$user) {
array_push($errors['email'], i::__('Email não encontrado', 'multipleLocal'));
$hasErrors = true;
}

if (!$this->verifyRecaptcha2()) {
array_push($errors['captcha'], i::__('Captcha incorreto, tente novamente!', 'multipleLocal'));
$hasErrors = true;
}

if (!$hasErrors) {
// generate the hash
$source = rand(3333, 8888);
Expand Down Expand Up @@ -1017,7 +1023,10 @@ function doLogin() {

if (!$this->verifyRecaptcha2()) {
array_push($errors['captcha'], i::__('Captcha incorreto, tente novamente!', 'multipleLocal'));
$hasErrors = true;
return [
'success' => false,
'errors' => $errors
];
}

$email = filter_var($app->request->post('email'), FILTER_SANITIZE_EMAIL);
Expand Down

0 comments on commit 6eab0e1

Please sign in to comment.