/** * Valida que el usuario y la contraseña sean validas. * @param string $login login del usuario * @param string $password password del usuario * @return bool * @throw NotFoundException en caso de que el usuario no exista. */ public function isValid($login, $password) { $userDAO = DAOFactory::getInstance()->getUserDAO(); $user = $userDAO->findByLogin($login); if (empty($user)) { throw new NotFoundException('Usuario inexistente'); } return md5($password) == $user->getPassword(); }
public function deleteMovie($movieId) { $movieDAO = DAOFactory::getInstance()->getMovieDAO(); try { $movie = $movieDAO->findByPK($movieId); if (empty($movie)) { throw new \Exception('Película inexistente', 404); } return $movieDAO->delete($movie); } catch (\Exception $exc) { throw new \Exception("Error al eliminar película. " . $exc->getMessage(), 400); } }