public function logout() { $this->module('auth')->logout(); if ($this->req_is('ajax')) { return '{"logout":1}'; } else { $this->reroute('/auth/login'); } }