Tank Auth 的 Codeigniter 路由设置

发布于 2024-09-27 19:23:16 字数 492 浏览 7 评论 0原文

我正在为我的应用程序使用 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

I'm using Tank-Auth for my application. And the only problem 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

—━☆沉默づ 2024-10-04 19:23:16

解决方案是将 (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";

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";
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文