Welcome Guest, Not a member yet? Register   Sign In
$this->request->getVar('account_id') NULL for no reason
#1

Hi All,
I have created filter to check JWT token and then I am adding values to request, so that I can use in Controller. It is absolutely working fine on 5 routes, but somehow getVar is giving null value for another function in controller.

Code:
public function verifyAccountCode()
    {       
        $account_id = $this->request->getVar('account_id');
        $is_active = $this->request->getVar('is_active');
        $verification_code = $this->request->getVar('verification_code');
       
        var_dump($this->request->getVar('account_id'));


        return $this->respond(['acc' => $account_id], 200);
     


    }

Filter:
Code:
$model = new AccountsModel();
$user = $model->select(['account_id','username','email','is_active','timezone'])->where('account_id', $decoded['account_id'])->first();           
$request->setGlobal('request', $user);

Routes.php
Code:
$routes->post('/resend-verification-code', 'AccountVerification::sendVerificationCode', ['filter' => 'auth_acc_inactive']);
$routes->post('/verify-account', 'Accounts::verifyAccountCode', ['filter' => 'auth_acc_inactive']);

It is absolutely working fine for /resend-verification-code, but somehow giving NULL value for /verify-account. Code is same in both the functions.

Any idea guys? I checked on Google and there was thread that there been bug in i think 4.0.4 codeigniter version. But I am using the latest on with php8.1

Any clue guys?
Reply


Messages In This Thread
$this->request->getVar('account_id') NULL for no reason - by encodedigital - 10-19-2022, 10:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB