I'm trying to make a password reset link and I want to know if I can make an action with the name of the token. So I will access the link like this site.com/auth/resetpassword/token.
I can't find anything documented on the internet.
I'm generating my token like this:
$lengthSalt = 24;
$token = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyz"), 0, $lengthSalt);
You need to define proper route
Example for Zend 1.10: http://framework.zend.com/manual/1.10/en/zend.controller.router.html
$router = $ctrl->getRouter(); // returns a rewrite router by default
$router->addRoute(
'resetpass',
new Zend_Controller_Router_Route('auth/resetpassword/:token',
array('controller' => 'auth',
'action' => 'resetpassword'))
);
This depends on the way you define your routes, there are more than one way to do it.
EDIT: If you want to work with default routes, you'll need to use this pattern: www.yoursite.com/controller/action/var1/value1/var2/value2.
So for you, it would be site.com/auth/resetpassword/token/[token], where in place of [token] you put your token value.
Then, you can acces your variable in controller:
$token = $this->getRequest()->getParam('token');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.