I am working on a
basic blog application in Codeigniter 3.1.8 and Bootstrap 4.
I have added a registration and login system to this application. I am current working on a password reset system.
In the Changepasword controller, the `index` method takes the parameters `$email` and `$token`:
PHP Code:
public function index($email, $token) {
$data = $this->Static_model->get_static_data();
$data['pages'] = $this->Pages_model->get_pages();
$data['tagline'] = 'New password';
$data['categories'] = $this->Categories_model->get_categories();
// Form validation rules
$this->form_validation->set_rules('password', 'Password', 'required|min_length[6]');
$this->form_validation->set_rules('cpassword', 'Confirm password', 'required|matches[password]');
$this->form_validation->set_error_delimiters('<p class="error-message">', '</p>');
if(!$this->form_validation->run()) {
$this->load->view('partials/header', $data);
$this->load->view('auth/newpassword');
$this->load->view('partials/footer');
} else {
$this->Usermodel->set_new_password($email, $token);
}
}
In the routes file I have this line for the above controller:
PHP Code:
$route['changepasword/(:any)/(:any)'] = 'changepasword/$1/$2/';
The entire routes file:
PHP Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$route['default_controller'] = 'posts';
$route['install'] = 'install';
$route['migrate'] = 'migrate';
$route['register'] = 'register';
$route['login'] = 'login';
$route['newpassword'] = 'newpassword';
$route['changepasword'] = 'changepasword';
$route['changepasword/(:any)/(:any)'] = 'changepasword/$1/$2/';
$route['dashboard'] = 'dashboard';
$route['dashboard/create-post'] = 'dashboard/posts/create';
$route['dashboard/create-page'] = 'dashboard/pages/create';
$route['dashboard/create-category'] = 'dashboard/categories/create';
$route['dashboard/manage-authors'] = 'dashboard/users';
$route['404_override'] = '';
$route['categories/posts/(:any)'] = 'categories/posts/$1';
$route['(:any)'] = 'posts/post/$1';
$route['translate_uri_dashes'] = FALSE;
I also added this to the `config.php` file:
PHP Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_()@=&\-!';
Yet, at the URL `http://ciblog.com/changepasword/
[email protected]/f450469ac1970b06074acb7c430d431d` instead of the view being rendered, I get the error:
404 Page Not Found
The page you requested was not found.
If I use
Code:
md5($this->user_email)
instead of $
I get the URL: `http://ciblog.com/changepasword/ec9814883d7f7149bc15f1ed1f472da9/d7571dc4e25ea76278bee5eb45251f11, but still, the
404 Page Not Found error message.
What am I doing wrong?