__model)) return $this->__model; $this->__model = ActivateCodeModel::get(array( [ 'name' => 'obj.activate_slug', 'type' => '=', 'value' => $this->url_context['url_1'] // slug ] )); if(empty($this->__model)) throw new HttpExceptions\NotFound404('The account activation link is invalid'); return $this->__model; } public function get_context_data() { $context = parent::get_context_data(); $activation_model = $this->get_model(); $user = UserModel::get(array( [ 'name' => 'obj.id', 'type' => '=', 'value' => $activation_model->field_user_id ] )); if($user->field_is_active) throw new HttpExceptions\BadRequest400("The account already activated"); $user->field_is_active = true; $user->save(); return $context; } }