Tank Auth的Codeigniter路由设置

时间:2010-10-12 17:30:56

标签: codeigniter routing tankauth

我正在使用Tank-Auth作为我的应用程序。我唯一的问题是激活和重置帐户密码。

登录,注册,注销;我对这些代码没有任何问题;

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

但是,对于激活帐户和重置密码,这些代码无效;

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

PS:'activate'后的第一个段是'user id',第二个段是这样的键:example.com/activate/2/4784322e48916efec1153c53d25453c7

1 个答案:

答案 0 :(得分:3)

解决方案是改变(auth)控制器中的url段:

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

到此:

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

此更改后,activate& reset_password的路由正在使用这些规则

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