Fixed editing account settings

This commit is contained in:
Marcin Kurczewski 2014-09-10 17:42:39 +02:00
parent d44e9c9ac9
commit 0283b2055d

View file

@ -27,19 +27,19 @@ class UserEditFormData implements \Szurubooru\IValidatable
public function validate(\Szurubooru\Validator $validator) public function validate(\Szurubooru\Validator $validator)
{ {
if ($this->userName !== null) if ($this->userName !== null)
$this->validator->validateUserName($formData->userName); $validator->validateUserName($this->userName);
if ($formData->password !== null) if ($this->password !== null)
$this->validator->validatePassword($formData->password); $validator->validatePassword($this->password);
if ($formData->email !== null) if ($this->email !== null)
$this->validator->validateEmail($formData->email); $validator->validateEmail($this->email);
if ($formData->browsingSettings !== null) if ($this->browsingSettings !== null)
{ {
if (!is_string($formData->browsingSettings)) if (!is_string($this->browsingSettings))
throw new \InvalidArgumentException('Browsing settings must be stringified JSON.'); throw new \InvalidArgumentException('Browsing settings must be stringified JSON.');
else if (strlen($formData->browsingSettings) > 2000) else if (strlen($this->browsingSettings) > 2000)
throw new \InvalidArgumentException('Stringified browsing settings can have at most 2000 characters.'); throw new \InvalidArgumentException('Stringified browsing settings can have at most 2000 characters.');
} }
} }