Fixed isocode country validator

restricted value to be a string

Change-Id: If3ef74ae5144bc2a35265f09952b9b9b6e5dfdda
This commit is contained in:
smarcet 2019-02-27 15:27:57 -03:00
parent 0f50f0eaf6
commit b9cbcd3e24
2 changed files with 2 additions and 2 deletions

View File

@ -545,7 +545,7 @@ final class OAuth2SummitSpeakersApiController extends OAuth2ProtectedController
'willing_to_travel' => 'sometimes|boolean',
'willing_to_present_video' => 'sometimes|boolean',
'org_has_cloud' => 'sometimes|boolean',
'country' => 'sometimes|country_iso_alpha2_code',
'country' => 'sometimes|string|country_iso_alpha2_code',
// collections
'languages' => 'sometimes|int_array',
'areas_of_expertise' => 'sometimes|string_array',

View File

@ -586,7 +586,7 @@ class AppServiceProvider extends ServiceProvider
$validator->addReplacer('country_iso_alpha2_code', function($message, $attribute, $rule, $parameters) use ($validator) {
return sprintf("%s should be a valid country iso code", $attribute);
});
if(!is_string($value)) return false;
$value = trim($value);
return isset($countries[$value]);
});