_user = $userManager->findOneUserByPasswordResetToken($token); if (!$this->_user) { throw new InvalidParamException('Wrong password reset token.'); } parent::__construct($config); } /** * @inheritdoc */ public function rules() { return [ ['password', 'required'], ['password', 'string', 'min' => 6], ]; } /** * Resets password. * * @return boolean if password was reset. */ public function resetPassword() { $userManager = UserManager::getInstance(); $user = $this->_user; $userManager->setPassword($user, $this->password); $userManager->removePasswordResetToken($user); return $user->save(); } public function attributeLabels() { return [ 'password' => 'Mot de passe', ]; } }