<?php
/* ----------------------------------------------------
 * Nazzo
 * @version 0.9.0
 * @author ken Kikuchi
 * http://www.i-approach.com/
 *
 * Licensed under the MIT licenses.
*/

class UsersController extends AppController {
  var $name = 'Users';
  var $helpers = array('Html', 'Form');
  var $components = array('mobile');

	function beforeFilter() {
		if($this->User->find('count') == 0) {
			$this->Auth->allow('admin_add');
    	}
	}

  //Login
  function admin_login(){
  }

  //Logout
  function admin_logout(){
    $this->Session->setFlash('You have logged out successfully.');
    $this->redirect($this->Auth->logout());
  }

  //User add
  function admin_add() {
    if (!empty($this->data)) {
        $this->User->create();
        $this->User->save($this->data['User']);
        $this->redirect(array('controller' => 'posts', 'action' => 'index', 'admin' => true));

    }
  }
}
?>