public function isValid(array $values) { $isValid = parent::isValid($values); if (!$isValid) { return false; } if (!$this->isMatch()) { $this->setError('confirm', 'Passwords do not match'); return false; } return true; }
public function isValid(array $values) { $isValid = parent::isValid($values); if (!$isValid) { return false; } $users = new Users(); $user = $users->fetch('email', $values['email']); if (!$user) { $this->setError('email', 'User does not exist'); return false; } return true; }
public function isValid(array $values) { $isValid = parent::isValid($values); if (!$isValid) { return false; } $users = new Users(); if ($users->fetch('email', $values['email'])) { $this->setError('email', 'Email is already in use'); return false; } if ($users->fetch('username', $values['username'])) { $this->setError('username', 'Username already exists'); return false; } if (!$this->isMatch()) { $this->setError('confirm', 'Passwords do not match'); return false; } return true; }