commit 26d1f8520bc3fbcda60041a5d50998258600863a
Author: hasse <hasegawa@i-hearts.jp>
Date:   Fri Mar 11 06:28:02 2016 -0500

    退会機能完了

diff --git a/app/Controller/UsersController.php b/app/Controller/UsersController.php
index 13ed82d..2ebbf4c 100755
--- a/app/Controller/UsersController.php
+++ b/app/Controller/UsersController.php
@@ -14,7 +14,7 @@ class UsersController extends AppController {
 
     public function beforeFilter() {
         parent::beforeFilter();
-        $this->Auth->allow('register','activate','confirm','sent','login','reset_pwd','reset_pwd_confirm','reset_pwd_sent','newpwd','reset_pwd_comp_mail');
+        $this->Auth->allow('register','activate','confirm','sent','login','reset_pwd','reset_pwd_confirm','reset_pwd_sent','newpwd','reset_pwd_comp_mail','withdraw_comp');
     }
 
 /**
@@ -189,9 +189,9 @@ class UsersController extends AppController {
  * register confirm
  */
 	public function withdraw_check() {
-		if (!$this->User->exists()) {
-			return $this->redirect(array('controller' => 'top','action' => 'index'));
-		}
+		// if (!$this->User->exists()) {
+		// 	return $this->redirect(array('controller' => 'top','action' => 'index'));
+		// }
 	}
 
 /**
@@ -201,21 +201,10 @@ class UsersController extends AppController {
  * @param string $id
  * @return void
  */
-	public function withdraw_comp($id = null) {
-		$this->User->id = $id;
-		if (!$this->User->exists()) {
-			throw new NotFoundException(__('Invalid user'));
-		}
-		$this->request->allowMethod('post', 'delete');
-			// statusフィールドを1に更新
-	        $this->User->saveField( 'status', 0);
-			return $this->redirect(array('controller' => 'top','action' => 'index'));
-		// if ($this->User->delete()) {
-		// 	$this->Flash->success(__('The user has been deleted.'));
-		// } else {
-		// 	$this->Flash->error(__('The user could not be deleted. Please, try again.'));
-		// }
-		// return $this->redirect(array('action' => 'index'));
+	public function withdraw_comp() {
+	    $this->User->id = $this->Auth->user('id');
+	    $this->User->saveField( 'status', 0);
+	    $this->Session->write('Auth', $user);
 	}
 
 /**
@@ -227,7 +216,6 @@ class UsersController extends AppController {
  */
 	public function login() {
 		if($this->Auth->user()){
-			// $this->redirect($this->Auth->redirectUrl());                          
 					$this->redirect('/users/login_top');                          
 		}
 		if ($this->request->is('post')) {
