コード例 #1
0
ファイル: UserController.php プロジェクト: 2philgit/mudeo
 public function deleteaccount()
 {
     $passwordError = "Your account has deleted!";
     $auth = new \W\Security\AuthentificationManager();
     $usermanager = new \Manager\UserManager();
     $usermanager->delete($_SESSION['user']['id']);
     $auth->logUserOut();
     setcookie("auth", "", time() - 3600, '/', 'localhost', false, true);
     $this->redirectToRoute('home', ["passwordError" => $passwordError]);
 }
コード例 #2
0
ファイル: functions.php プロジェクト: 2philgit/mudeo
function confirmAccount($token, $subscription)
{
    //die(time().'---'.$token.'---->'.$subscription);
    if ($token != 0 && time() < $token && $subscription == 0) {
        $response[0] = true;
        $response[1] = "Log correct but please check your mail for confirmation's account !";
    } else {
        if ($token != 0 && time() > $token && $subscription == 0) {
            $usermanager = new \Manager\UserManager();
            $auth = new \W\Security\AuthentificationManager();
            $usermanager->delete($_SESSION['user']['id']);
            $auth->logUserOut();
            setcookie("auth", "", time() - 3600, '/', 'localhost', false, true);
            $response[0] = false;
            $response[1] = "Your account don't confirm during 3 days so I deleted it Mother F****r!";
        } else {
            $response[0] = true;
            $response[1] = "Log correct !";
        }
    }
    return $response;
}
コード例 #3
0
 public function deleteUser($userId)
 {
     // je récupère la ligne en DB
     $userManager = new \Manager\UserManager();
     $currentUser = $userManager->find($userId);
     if (!is_numeric($userId)) {
         $this->redirectToRoute('profil');
     }
     // je compare le mdp rentré par l'utilisateur et celui en DB
     if (password_verify($_POST['password-client'], $currentUser['password'])) {
         // si c'est true
         // je supprime le compte
         $userManager->delete($userId);
         // puis je le recré avec le meme id, nom et prenom mais sans pass ni email
         $userManager->insert(['id' => $userId, 'nom' => $currentUser['nom'], 'prenom' => $currentUser['prenom'], 'role' => 'client']);
         $this->redirectToRoute('logoff');
     }
     $this->show('user/profil_error', ['errorPass' => true]);
 }