function register($data) { $this->fields['password']['required'] = true; $errors = $this->validate($data); unset($data['pass2']); if ($errors) { unset($data['password']); return ['errors' => $errors, 'profile' => $data]; } $data['password'] = sha1($data['password']); $data['active'] = true; $data['hash'] = $this->generate_token(); $data['id'] = $this->add($data); unset($data['password']); $this->user_settings_model->add(['users_id' => $data['id']]); $this->send_email($data['id'], lang('welcome_email_subject'), lang('welcome_email')); return ['errors' => '', 'profile' => $data]; }
public function settings_get() { $this->auth(); try { $this->response($this->user_settings_model->get_user_settings($this->user_id), 200); } catch (Exception $e) { $this->response($e->getMessage(), $e->getCode()); } }