Ejemplo n.º 1
0
 private function ajax_name_api(array $data)
 {
     if ($this->request->is_not_set($data['name'])) {
         \cx\app\cx_api::error(array('code' => 422, 'reason' => 'Name not set'));
     }
     if ($this->request->is_empty($data['name'])) {
         \cx\app\cx_api::error(array('code' => 422, 'reason' => 'Name is a required field'));
     }
     \cx\app\cx_api::ok(array('code' => 200, 'name' => $data['name']));
 }
Ejemplo n.º 2
0
 public function do_login_redirect()
 {
     if ($this->is_api()) {
         \cx\app\cx_api::error(array('code' => 401, 'reason' => 'Invalid Login'));
     }
     $this->page_redirect($this->get_url('/app/' . DEFAULT_PROJECT, 'login'));
 }