Ejemplo n.º 1
0
 public function create($request)
 {
     if (Session::isActive()) {
         $req = $request->getParameters();
         $resp = $this->index($request);
         if ($req['name'] != '' && $req['channel_id'] != '') {
             if (UserChannel::exists($req['channel_id'])) {
                 if (UserChannel::find($req['channel_id'])->belongToUser(Session::get()->id)) {
                     if (!Playlist::exists(array('conditions' => array('name = ? AND channel_id = ?', $req['name'], $req['channel_id'])))) {
                         Playlist::create(array('name' => $req['name'], 'channel_id' => $req['channel_id'], 'videos_ids' => json_encode(array()), 'timestamp' => Utils::tps()));
                         // Oui cette ligne est dupliquée mais ce n'est pas une erreur, ne pas supprimer SVP
                         $resp = $this->index($request);
                         $resp->addMessage(ViewMessage::success('Playlist ajoutée avec succès !'));
                     } else {
                         $resp->addMessage(ViewMessage::error('Une playlist du même nom existe déjà sur cette chaîne.'));
                     }
                 } else {
                     $resp->addMessage(ViewMessage::error('Cette chaîne ne vous appartient pas.'));
                 }
             } else {
                 $resp->addMessage(ViewMessage::error('Cette chaîne n\'existe pas !'));
             }
         } else {
             $resp->addMessage(ViewMessage::error('Merci de remplir tous les champs'));
         }
     }
     return $resp;
 }
Ejemplo n.º 2
0
 public function create($request)
 {
     $req = $request->getParameters();
     $response = new ViewResponse('assist/ticket');
     if (trim($req['bug']) != '') {
         if (Session::isActive()) {
             $user_id = Session::get()->id;
         } else {
             if (trim($req['email']) != '') {
                 $user_id = $req['email'];
             } else {
                 $user_id = 0;
             }
         }
         $ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
         $ticket_id = $ticket->id;
         $response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
         /*$username = (Session::isActive()) ? Session::get()->username : '******';
         		$notif = new PushoverNotification();
         		$notif->setMessage('Nouveau ticket de '.$username);
         		$notif->setReceiver('all');
         		$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
         		$notif->send();*/
     } else {
         $response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
     }
     return $response;
 }
Ejemplo n.º 3
0
 public function create($request)
 {
     $req = $request->getParameters();
     $response = new ViewResponse('assist/ticket');
     if (trim($req['bug']) != '') {
         if (Session::isActive()) {
             $user_id = Session::get()->id;
         } else {
             if (trim($req['email']) != '') {
                 $user_id = $req['email'];
             } else {
                 $user_id = 0;
             }
         }
         if (!empty(Ticket::find('all', ['conditions' => ['ip = ? AND timestamp < ' . (Utils::tps() + 60), $_SERVER['REMOTE_ADDR']]]))) {
             $r = $this->index($request);
             $r->addMessage(ViewMessage::error('Trop d\'envois avec la même IP en une minute, réssayez plus tard.'));
             return $r;
         }
         $ticket = Ticket::create(array('user_id' => $user_id, 'description' => $req['bug'], 'timestamp' => time(), 'ip' => $_SERVER['REMOTE_ADDR']));
         StaffNotification::createNotif('ticket', $user_id, null, $ticket->id);
         $ticket_id = $ticket->id;
         $response->addMessage(ViewMessage::success('Envoyé ! Vous serez notifié de l\'avancement par E-Mail ou Message Privé (Ticket #' . $ticket_id . ')'));
         /*$username = (Session::isActive()) ? Session::get()->username : '******';
         		$notif = new PushoverNotification();
         		$notif->setMessage('Nouveau ticket de '.$username);
         		$notif->setReceiver('all');
         		$notif->setExtraParameter('url', 'http://dreamvids.fr'.WEBROOT.'admin/tickets');
         		$notif->send();*/
     } else {
         $response->addMessage(ViewMessage::error('Merci de nous décrire votre problème.'));
     }
     return $response;
 }
Ejemplo n.º 4
0
 public function create($request)
 {
     $data = $request->getParameters();
     if (isset($data['submitLogin']) && !Session::isActive()) {
         $is_admin = isset($data['is_admin']) && $data['is_admin'] == 1;
         $username = Utils::secure($data['username']);
         $password = Utils::secure($data['pass']);
         if (User::find_by_username($username)) {
             $user = User::find_by_username($username);
             $current_log_fail = $user->getLogFails();
             if (!$user->isAllowedToAttemptLogin()) {
                 $next_timestamp = $current_log_fail['next_try'];
                 $last_try_timestamp = $current_log_fail['last_try'];
                 $nb_try = $current_log_fail['nb_try'];
                 $next_try_tps = $next_timestamp - Utils::tps();
                 $next_try_min = floor($next_try_tps / 60);
                 $next_try_sec = round($next_try_tps - $next_try_min * 60);
                 $next_try_str = "{$next_try_min} m et {$next_try_sec} s";
                 $data = isset($data['redirect']) ? ['redirect' => $data['redirect']] : [];
                 $data['currentPageTitle'] = 'Connexion';
                 $response = !$is_admin ? new ViewResponse('login/login', $data) : new ViewResponse('admin/login/login', $data, true, 'layouts/admin_login.php', 401);
                 $response->addMessage(ViewMessage::error($nb_try . " tentatives de connexions à la suite pour ce compte. Veuillez patienter {$next_try_str}"));
                 return $response;
             }
             $realPass = User::find_by_username($username)->getPassword();
             if (password_verify($password, $realPass)) {
                 User::connect($username, 1);
                 $user->resetLogFails();
                 return new RedirectResponse($data['redirect'] ? urldecode($data['redirect']) : WEBROOT);
             } else {
                 if (sha1($password) == $realPass) {
                     $user->resetLogFails();
                     User::connect($username, 1)->setPassword(password_hash($password, PASSWORD_BCRYPT));
                     return new RedirectResponse($data['redirect'] ? urldecode($data['redirect']) : WEBROOT);
                 }
                 if (!$user->isIntervalBetweenTwoLogAttemptElapsed() || !$current_log_fail) {
                     $user->addLogFail();
                 } else {
                     $user->resetLogFails();
                     $user->addLogFail();
                 }
                 $data = isset($data['redirect']) ? ['redirect' => $data['redirect']] : [];
                 $data['currentPageTitle'] = 'Connexion';
                 $response = !$is_admin ? new ViewResponse('login/login', $data) : new ViewResponse('admin/login/login', $data, true, 'layouts/admin_login.php', 401);
                 $response->addMessage(ViewMessage::error('Mot de passe incorrect'));
                 return $response;
             }
         } else {
             $data = isset($data['redirect']) ? ['redirect' => $data['redirect']] : [];
             $data['currentPageTitle'] = 'Connexion';
             $response = !$is_admin ? new ViewResponse('login/login', $data) : new ViewResponse('admin/login/login', $data, true, 'layouts/admin_login.php', 401);
             $response->addMessage(ViewMessage::error('Ce nom d\'utilisateur n\'existe pas'));
             return $response;
         }
     }
 }
Ejemplo n.º 5
0
 public function edit($id, $request)
 {
     $data = [];
     if (User::exists(['id' => $id])) {
         $data['user'] = User::find($id);
         $r = new ViewResponse("admin/user/edit", $data);
     } else {
         $r = new ViewResponse("admin/user/edit");
         $r->addMessage(ViewMessage::error("L'utilisateur n'existe pas."));
     }
     return $r;
 }
Ejemplo n.º 6
0
 public function edit($id, $request)
 {
     $data = [];
     if ($id == '' || !Eggs::exists(['id' => $id])) {
         return new RedirectResponse(WEBROOT . 'admin/egg');
     }
     $egg = Eggs::find_by_id($id);
     $data['egg'] = $egg;
     $data['edit'] = true;
     $r = new ViewResponse('admin/egg/edit', $data);
     if ($egg->found) {
         $r->addMessage(ViewMessage::error("Attention, cet oeuf a déjà été trouvé par quelqu'un !"));
     }
     return $r;
 }
Ejemplo n.º 7
0
 public function create($request)
 {
     $params = $request->getParameters();
     if ($params['name'] == '') {
         $data['params'] = $params = $request->getParameters();
         $data['partners'] = Partners::find('all');
         $r = new ViewResponse('admin/partners/index', $data);
         $r->addMessage(ViewMessage::error("Champs 'Nom' manquant"));
     } else {
         Partners::create(['name' => $params['name'], 'url' => $params['url'], 'contact_email' => $params['contact_email']]);
         $r = $this->index($request);
         $r->addMessage(ViewMessage::success("Partenaire ajouté"));
     }
     return $r;
 }
Ejemplo n.º 8
0
 public function update($id, $request)
 {
     $req = $request->getParameters();
     if (Faq::exists($id)) {
         $faq = Faq::find($id);
     } else {
         $r = $this->index($request);
         $r->addMessage(ViewMessage::error("Id inexistant."));
         return $r;
     }
     foreach (self::$fields as $field) {
         if (isset($req[$field])) {
             $faq->{$field} = $req[$field];
         }
     }
     $faq->save();
     $r = new ViewResponse('admin/faq/edit', ['faq' => $faq]);
     $r->addMessage(ViewMessage::success("Cette question réponse à bien été sauvegardée. <a href=\"" . WEBROOT . "admin/faq\">Retour à la liste</a>"));
     return $r;
 }
Ejemplo n.º 9
0
 public function update($id, $request)
 {
     $req = $request->getParameters();
     if (!Session::isActive()) {
         return Utils::getUnauthorizedResponse();
     }
     if ($video = Video::find($id)) {
         if (isset($req['video-edit-submit'], $req['video-title'], $req['video-description'], $req['video-tags'])) {
             $data = array();
             $data['currentPageTitle'] = $video->title . ' - Modification';
             if (UserChannel::find(Video::find($id)->poster_id)->belongToUser(Session::get()->id) || Session::get()->isModerator() || Session::get()->isAdmin()) {
                 $data['video'] = $video;
                 $title = $req['video-title'];
                 $description = $req['video-description'];
                 $tags = $req['video-tags'];
                 $visibility = $req['video-visibility'];
                 if (Utils::validateVideoInfo($title, $description, $tags) && in_array($visibility, array(0, 1, 2))) {
                     $video->updateInfo($title, $description, $tags, $req['_FILES_']['tumbnail'], $visibility);
                     $data['video'] = $video;
                     $response = new ViewResponse('video/edit', $data);
                     $response->addMessage(ViewMessage::success('Votre video a bien été modifiée !'));
                     return $response;
                 } else {
                     $response = new ViewResponse('video/edit', $data);
                     $response->addMessage(ViewMessage::error('Les informations ne sont pas valides.'));
                     return $response;
                 }
             }
         } else {
             if (isset($req['flag']) && !empty($req['flag'])) {
                 $flag = $req['flag'];
                 if ($flag == 'false' && (Session::get()->isModerator() || Session::get()->isAdmin())) {
                     $video->unFlag(Session::get()->id);
                     return new Response(200);
                 } else {
                     if ($flag == 'true') {
                         $video->flag(Session::get()->id);
                         return new Response(200);
                     }
                 }
             } else {
                 if (isset($req['suspend']) && !empty($req['suspend']) && (Session::get()->isModerator() || Session::get()->isAdmin())) {
                     $suspend = $req['suspend'];
                     if ($suspend == 'false') {
                         $video->unSuspend(Session::get()->id);
                         return new Response(200);
                     } else {
                         if ($suspend == 'true') {
                             $video->suspend(Session::get()->id);
                             return new Response(200);
                         }
                     }
                 } else {
                     if (isset($req['like'])) {
                         $userId = Session::get()->id;
                         if (!$video->isLikedByUser($userId)) {
                             if ($video->isDislikedByUser($userId)) {
                                 $video->removeDislike($userId);
                             }
                             $video->like($userId);
                             return new Response(200);
                         }
                     } else {
                         if (isset($req['dislike'])) {
                             $userId = Session::get()->id;
                             if (!$video->isDislikedByUser($userId)) {
                                 if ($video->isLikedByUser($userId)) {
                                     $video->removeLike($userId);
                                 }
                                 $video->dislike($userId);
                                 return new Response(200);
                             }
                         } else {
                             if (isset($req['unlike'])) {
                                 $userId = Session::get()->id;
                                 if ($video->isLikedByUser($userId)) {
                                     $video->removeLike($userId);
                                     return new Response(200);
                                 }
                             } else {
                                 if (isset($req['undislike'])) {
                                     $userId = Session::get()->id;
                                     if ($video->isDislikedByUser($userId)) {
                                         $video->removeDislike($userId);
                                         return new Response(200);
                                     }
                                 } else {
                                     if (isset($req['discover']) && (Session::get()->isModerator() || Session::get()->isAdmin())) {
                                         $video->discover = Utils::tps();
                                         $video->save();
                                         $author = $video->getAuthor();
                                         $receiver = ChannelAction::filterReceiver($author->admins_ids, "staff_select");
                                         ChannelAction::create(['id' => ChannelAction::generateId(6), 'channel_id' => $author->id, 'recipients_ids' => $receiver, 'type' => 'staff_select', 'target' => $video->id, 'timestamp' => Utils::tps()]);
                                         return new Response(200);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return new Response(500);
 }
Ejemplo n.º 10
0
 public function get($key, $request)
 {
     if (Password::exists(array('key' => $key))) {
         $pass = Password::find_by_key($key);
         $user = User::find($pass->user_id);
         $pass->delete();
         $pass = Password::generatePass(9);
         $user->pass = password_hash($pass, PASSWORD_BCRYPT);
         $user->save();
         $data = array();
         $data['currentPageTitle'] = 'Connexion';
         $resp = new ViewResponse('login/login', $data);
         $resp->addMessage(ViewMessage::success('Voici votre nouveau mot de passe: <b>' . $pass . '</b>. Connectez-vous dès maintenant !'));
         return $resp;
     } else {
         $data = array();
         $data['currentPageTitle'] = 'Mot de passe oublié';
         $resp = new ViewResponse('password/password', $data);
         $resp->addMessage(ViewMessage::error('Clé invalide ou expirée, merci de recommencer la procédure'));
         return $resp;
     }
 }
Ejemplo n.º 11
0
 public function videos($id, $request)
 {
     if (Session::isActive() && UserChannel::find($id)->belongToUser(Session::get()->id)) {
         $data['videos'] = UserChannel::find($id)->getPostedVideos(false);
         $data['currentPageTitle'] = 'Mon compte';
         $data['current'] = 'videos';
         $response = new ViewResponse('account/videos', $data);
         if (empty($data['videos'])) {
             $response->addMessage(ViewMessage::error('Vous n\'avez posté aucune vidéo'));
         }
         return $response;
     } else {
         return new RedirectResponse(Utils::generateLoginURL());
     }
 }
Ejemplo n.º 12
0
 public function update($id, $request)
 {
     $req = $request->getParameters();
     $data = $req;
     $data['current'] = 'channels';
     $name = @$req['name'];
     $descr = @$req['description'];
     $admins = @json_decode($req['_admins']);
     if (isset($req['editChannelSubmit']) && Session::isActive()) {
         $channel = UserChannel::exists($id) ? UserChannel::find($id) : UserChannel::find_by_name($id);
         if (!is_object($channel)) {
             return Utils::getNotFoundResponse();
         }
         if (!$channel->belongToUser(Session::get()->id)) {
             return Utils::getForbiddenResponse();
         }
         $data['mainChannel'] = $channel->isUsersMainChannel(Session::get()->id);
         $data['name'] = $channel->name;
         $data['description'] = $channel->description;
         $data['currentPageTitle'] = $channel->name . ' - Edition';
         $data['owner_id'] = $channel->owner_id;
         $admins_array_ids = explode(';', trim($channel->admins_ids, ';'));
         $data['admins_ids'] = $admins_array_ids;
         $data['admins'] = array();
         foreach ($admins_array_ids as $adm) {
             $data['admins'][] = User::find_by_id($adm)->getMainChannel();
         }
         if (isset($req['name'], $req['description'])) {
             if (strlen($name) >= 3 && strlen($name) <= 40) {
                 if (preg_match("#^[a-zA-Z0-9\\_\\-\\.]+\$#", $name)) {
                     if ($channel->isUsersMainChannel(Session::get()->id)) {
                         if ($channel->name != $req['name']) {
                             $data['name'] = $channel->name;
                             $response = new ViewResponse('channel/edit', $data);
                             $response->addMessage(ViewMessage::error('Vous ne pouvez pas changer le nom de votre chaîne principale !'));
                             return $response;
                         }
                     } else {
                         $adm = trim($channel->admins_ids, ';');
                         $adm = explode(';', $adm);
                         foreach ($admins as $admin) {
                             if ($admin > 0) {
                                 if (!in_array($admin, $adm)) {
                                     $adm[] = $admin;
                                     ChannelAction::create(array('id' => ChannelAction::generateId(6), 'channel_id' => $channel->id, 'recipients_ids' => ';' . $admin . ';', 'type' => 'admin', 'target' => $channel->id, 'timestamp' => Utils::tps()));
                                 }
                             } else {
                                 $value = -1 * $admin;
                                 if (in_array($value, $adm) && $channel->owner_id != $value) {
                                     $id = array_keys($adm, $value);
                                     unset($adm[$id[0]]);
                                     ChannelAction::create(array('id' => ChannelAction::generateId(6), 'channel_id' => $channel->id, 'recipients_ids' => ';' . $admin . ';', 'type' => 'unadmin', 'target' => $channel->id, 'timestamp' => Utils::tps()));
                                 }
                             }
                         }
                         $adm = ';' . implode(';', $adm) . ';';
                     }
                     UserChannel::edit($channel->id, $name, $descr, $adm, $req['_FILES_']['avatar'], $req['_FILES_']['background']);
                     //TODO: Support logo/background
                     $data['channels'] = Session::get()->getOwnedChannels();
                     $data['currentPageTitle'] = 'Mes chaines';
                     $response = new ViewResponse('account/channels', $data);
                     $response->addMessage(ViewMessage::success('Votre chaîne ' . $name . ' a bien été modifiée !'));
                     return $response;
                 } else {
                     $response = new ViewResponse('channel/edit', $data);
                     $response->addMessage(ViewMessage::error('Le nom de la chaîne doit contenir uniquement des lettres (majuscules et minuscules), des traits-d\'union, des _ et des points.'));
                     return $response;
                 }
             } else {
                 $response = new ViewResponse('channel/edit', $data);
                 $response->addMessage(ViewMessage::error('Le nom de la chaîne doit être compris entre 3 et 40 caractères.'));
                 return $response;
             }
         } else {
             $response = new ViewResponse('channel/edit', $data);
             $response->addMessage(ViewMessage::error('Tous les champs doivent être remplis.'));
             return $response;
         }
     } else {
         if (isset($req['subscribe'])) {
             if (Session::isActive()) {
                 $channel = UserChannel::exists($id) ? UserChannel::find($id) : UserChannel::find_by_name($id);
                 if (is_object($channel) && !$channel->belongToUser(Session::get()->id)) {
                     $channel->subscribe(Session::get()->id);
                     $response = new Response(200);
                     return $response;
                 }
             } else {
                 return new Response(500);
             }
         } else {
             if (isset($req['unsubscribe'])) {
                 if (Session::isActive()) {
                     $channel = UserChannel::exists($id) ? UserChannel::find($id) : UserChannel::find_by_name($id);
                     if (is_object($channel) && !$channel->belongToUser(Session::get()->id)) {
                         $channel->unsubscribe(Session::get()->id);
                         $response = new Response(200);
                         return $response;
                     }
                 } else {
                     return new Response(500);
                 }
             } else {
                 if (isset($req['admin_edit'])) {
                     if (Session::isActive()) {
                         $channel = UserChannel::exists($id) ? UserChannel::find($id) : UserChannel::find_by_name($id);
                         if (!$channel) {
                             return Utils::getNotFoundResponse();
                         }
                         if (!$channel->isUsersMainChannel(Session::get()->id) && $channel->owner_id != Session::get()->id) {
                             if (in_array($channel, Session::get()->getOwnedChannels())) {
                                 $current_admins = $channel->admins_ids;
                                 $current_admins = trim($current_admins, ";");
                                 $current_admins = explode(";", $current_admins);
                                 foreach ($current_admins as $k => $admin) {
                                     if ($admin == Session::get()->id) {
                                         unset($current_admins[$k]);
                                         $channel->admins_ids = ";" . implode($current_admins, ";") . ";";
                                         $channel->save();
                                         return new RedirectResponse(WEBROOT . "channel/{$id}");
                                     }
                                 }
                             }
                         }
                     }
                     return Utils::getForbiddenResponse();
                 }
             }
         }
     }
 }
Ejemplo n.º 13
0
 public function create($request)
 {
     $req = $request->getParameters();
     if (isset($req['submitRegister'])) {
         if (isset($req['username'])) {
             if (isset($req['pass'])) {
                 if (isset($req['pass-confirm'])) {
                     if (isset($req['mail'])) {
                         if (isset($req["g-recaptcha-response"])) {
                             if (isset($req['CGU']) && $req['CGU'] == 'CGU') {
                                 $data = $_POST;
                                 $data['currentPageTitle'] = 'Inscription';
                                 $data["currentPage"] = "register";
                                 $url = "https://www.google.com/recaptcha/api/siteverify?secret=";
                                 //Adress a get
                                 $url .= Config::getValue_("recaptcha_private");
                                 //Cle prive
                                 $url .= "&response=" . $req['g-recaptcha-response'];
                                 // Resultat de captcha
                                 $check_captcha = true;
                                 if (isset($req['cavicon'])) {
                                     $key = "key";
                                     $check_captcha = $req['cavicon'] != $key;
                                 }
                                 $check_captcha = true;
                                 //Override
                                 if ($check_captcha) {
                                     $json_result = json_decode(file_get_contents($url), true);
                                     //Parsage de la reponse
                                     if (@$json_result["success"] != true) {
                                         $response = new ViewResponse('login/register', $data);
                                         $response->addMessage(ViewMessage::error('Erreur de captcha'));
                                         //Affichage de l'erreur
                                         return $response;
                                     }
                                 } else {
                                     //OK
                                 }
                             } else {
                                 $response = new ViewResponse('login/register', $data);
                                 $response->addMessage(ViewMessage::error('Merci d\'accepter nos conditions avant de vous inscrire'));
                                 return $response;
                             }
                         } else {
                             //Affichage de l'erreur
                             $response = new ViewResponse('login/register', $data);
                             $response->addMessage(ViewMessage::error('Erreur de captcha'));
                             return $response;
                         }
                         $username = Utils::secure($req['username']);
                         $pass = Utils::secure($req['pass']);
                         $pass2 = Utils::secure($req['pass-confirm']);
                         $mail = Utils::secure($req['mail']);
                         if (Utils::validateUsername($username) && Utils::validateMail($mail) && $pass2 != '' && $pass != '') {
                             if ($pass == $pass2) {
                                 if (!User::find_by_username($username)) {
                                     if (!User::isMailRegistered($mail)) {
                                         User::register($username, $pass, $mail);
                                         $created_user = User::find('first', array('username' => $username));
                                         $created_user->sendWelcomeNotification();
                                         $response = new ViewResponse('login/login');
                                         $response->addMessage(ViewMessage::success('Inscription validée. Vous pouvez vous connecter !'));
                                         return $response;
                                     } else {
                                         $response = new ViewResponse('login/register', $data);
                                         $response->addMessage(ViewMessage::error('Cette adresse e-mail est déjà enregistrée'));
                                         return $response;
                                     }
                                 } else {
                                     $response = new ViewResponse('login/register', $data);
                                     $response->addMessage(ViewMessage::error('Ce nom d\'utilisateur est déjà pris'));
                                     return $response;
                                 }
                             } else {
                                 $response = new ViewResponse('login/register', $data);
                                 $response->addMessage(ViewMessage::error('Les mots de passe ne correspondent pas'));
                                 return $response;
                             }
                         } else {
                             $response = new ViewResponse('login/register', $data);
                             $response->addMessage(ViewMessage::error('Veuillez saisir des informations valides (a-z/A-Z/0-9)'));
                             return $response;
                         }
                     } else {
                         $response = new ViewResponse('login/register', $data);
                         $response->addMessage(ViewMessage::error('L\'adresse e-mail est requise'));
                         return $response;
                     }
                 } else {
                     $response = new ViewResponse('login/register', $data);
                     $response->addMessage(ViewMessage::error('Veuillez confirmer le mot de passe'));
                     return $response;
                 }
             } else {
                 $response = new ViewResponse('login/register', $data);
                 $response->addMessage(ViewMessage::error('Le mot de passe est requis'));
                 return $response;
             }
         } else {
             $response = new ViewResponse('login/register', $data);
             $response->addMessage(ViewMessage::error('Le nom d\'utilisateur est requis'));
             return $response;
         }
     }
 }