예제 #1
0
 public function login()
 {
     // connexion au site
     if (isset($_SESSION['user'])) {
         $this->redirectToRoute('accueil');
         // si ok envoie page 2
     }
     if (isset($_POST['connexion'])) {
         $auth = new AuthentificationManager();
         $userManager = new UserManager();
         $UserManagerSuite = new GeneralManager();
         //debug($userManager); die; // vérification
         if ($auth->isValidLoginInfo($_POST['wuser']['mail'], $_POST['wuser']['mot_de_passe'])) {
             //selection table user
             $user_part1 = $userManager->getUserByUsernameOrEmail($_POST['wuser']['mail']);
             //recuperation de l'id de l'utilisateur connecté et jointure avec les autres tables.
             $id_user = $user_part1['id'];
             if ($user_part1['validation_inscription'] === 'true') {
                 $user_part2 = $UserManagerSuite->findAllLogUser($id_user);
                 $user = array_merge($user_part1, $user_part2);
                 // ajout de $user2 dans $user
                 $auth->logUserIn($user);
                 //debug($_SESSION['user']);die(); // vérification
                 $this->redirectToRoute('accueil');
             } else {
                 $this->show('home/home');
             }
         }
     }
     $this->show('home/home');
 }
예제 #2
0
 public function refreshUserMulti()
 {
     $app = getApp();
     $userManager = new UserManager();
     $userManager->setTable($app->getConfig('security_user_table'));
     $userFromSession = $this->getLoggedUser();
     if ($userFromSession) {
         $user_part1 = $userManager->find($userFromSession[$app->getConfig('security_id_property')]);
         //se connecte a la table wusers
         $UserManagerSuite = new GeneralManager();
         $id_user = $user_part1['id'];
         $user_part2 = $UserManagerSuite->findAllLogUser($id_user);
         $userFromDb = array_merge($user_part1, $user_part2);
         // ajout de $user2 dans $user
         if ($userFromDb) {
             $_SESSION["user"] = $userFromDb;
             return true;
         }
     }
     return false;
 }