リビジョン 26d1f852 app/Controller/UsersController.php

差分を見る:

app/Controller/UsersController.php
14 14

  
15 15
    public function beforeFilter() {
16 16
        parent::beforeFilter();
17
        $this->Auth->allow('register','activate','confirm','sent','login','reset_pwd','reset_pwd_confirm','reset_pwd_sent','newpwd','reset_pwd_comp_mail');
17
        $this->Auth->allow('register','activate','confirm','sent','login','reset_pwd','reset_pwd_confirm','reset_pwd_sent','newpwd','reset_pwd_comp_mail','withdraw_comp');
18 18
    }
19 19

  
20 20
/**
......
189 189
 * register confirm
190 190
 */
191 191
	public function withdraw_check() {
192
		if (!$this->User->exists()) {
193
			return $this->redirect(array('controller' => 'top','action' => 'index'));
194
		}
192
		// if (!$this->User->exists()) {
193
		// 	return $this->redirect(array('controller' => 'top','action' => 'index'));
194
		// }
195 195
	}
196 196

  
197 197
/**
......
201 201
 * @param string $id
202 202
 * @return void
203 203
 */
204
	public function withdraw_comp($id = null) {
205
		$this->User->id = $id;
206
		if (!$this->User->exists()) {
207
			throw new NotFoundException(__('Invalid user'));
208
		}
209
		$this->request->allowMethod('post', 'delete');
210
			// statusフィールドを1に更新
211
	        $this->User->saveField( 'status', 0);
212
			return $this->redirect(array('controller' => 'top','action' => 'index'));
213
		// if ($this->User->delete()) {
214
		// 	$this->Flash->success(__('The user has been deleted.'));
215
		// } else {
216
		// 	$this->Flash->error(__('The user could not be deleted. Please, try again.'));
217
		// }
218
		// return $this->redirect(array('action' => 'index'));
204
	public function withdraw_comp() {
205
	    $this->User->id = $this->Auth->user('id');
206
	    $this->User->saveField( 'status', 0);
207
	    $this->Session->write('Auth', $user);
219 208
	}
220 209

  
221 210
/**
......
227 216
 */
228 217
	public function login() {
229 218
		if($this->Auth->user()){
230
			// $this->redirect($this->Auth->redirectUrl());                          
231 219
					$this->redirect('/users/login_top');                          
232 220
		}
233 221
		if ($this->request->is('post')) {

他の形式にエクスポート: Unified diff