Move validation to the top
This commit is contained in:
parent
d9cc0910ef
commit
8ee6337aea
|
@ -132,14 +132,14 @@ class WC_Integration_MaxMind_Geolocation extends WC_Integration {
|
|||
* @throws Exception When the license key is invalid.
|
||||
*/
|
||||
public function validate_license_key_field( $key, $value ) {
|
||||
// Empty license keys have no need to validate the data.
|
||||
// Trim whitespaces and strip slashes.
|
||||
$value = $this->validate_password_field( $key, $value );
|
||||
|
||||
// Empty license keys have no need test downloading a database.
|
||||
if ( empty( $value ) ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
// Trim whitespaces and strip slashes.
|
||||
$value = $this->validate_password_field( $key, $value );
|
||||
|
||||
// Check the license key by attempting to download the Geolocation database.
|
||||
$tmp_database_path = $this->database_service->download_database( $value );
|
||||
if ( is_wp_error( $tmp_database_path ) ) {
|
||||
|
|
Loading…
Reference in New Issue