4

我正在为我的应用程序使用 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:“激活”之后的第一段是“用户ID”,第二段是这样的关键:example.com/activate/2/4784322e48916efec1153c53d25453c7

4

1 回答 1

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";
于 2010-10-13T21:41:44.050 回答