开发者

Codeigniter Routing Settings for Tank Auth

开发者 https://www.devze.com 2023-01-19 13:42 出处:网络
I\'m using Tank-Auth for my application. And the only prob开发者_运维百科lem I have is activating and resetting passwords for accounts.

I'm using Tank-Auth for my application. And the only prob开发者_运维百科lem I have is activating and resetting passwords for accounts.

For login, register, logout; I have no problem with this codes;

$route['login'] = "/auth/login";
$route['logout'] = "/auth/logout";
$route['register'] = "/auth/register";

But for activating accounts and resetting passwords, those codes are not working;

$route['activate/:num/:any'] = "/auth/activate/$1/$2";
$route['reset_password/:num/:any'] = "/auth/reset_password/$1/$2";

PS: The first segment after 'activate' is 'user id' and second segment is key like this: example.com/activate/2/4784322e48916efec1153c53d25453c7


The solution is changing url segments in the (auth) controller from this:

    $user_id        = $this->uri->segment(3);
    $new_pass_key    = $this->uri->segment(4);

to this:

    $user_id        = $this->uri->segment(2);
    $new_pass_key    = $this->uri->segment(3);

After this change, the routing for activate&reset_password is working with those rules

$route['activate/:num/:any'] = "/auth/activate/$1/$2";
$route['reset_password/:num/:any'] = "/auth/reset_password/$1/$2";
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号