/** * Validate a user object. * * Invokes User::validate(), * and additionally tests that the User's email address and username (if set) are unique across all users.'. * * @param User $user * @return array An array of error messages, or an empty array if the User is valid. */ public function validate(AUser $user) { $errors = $user->validate(); // If username is required, ensure it is set. if ($this->isUsernameRequired && !$user->getRealUsername()) { $errors['username'] = '******'; } return $errors; }
public function sendResetMessage(AUser $user) { $url = $this->baseUrl . $this->urlGenerator->generate(self::ROUTE_RESET_PASSWORD, array('token' => $user->getConfirmationToken()), true); $context = array('user' => $user, 'resetUrl' => $url); $this->sendMessage($this->resetTemplate, $context, $this->getFromEmail(), $user->getEmail()); }