2

我一直在玩这个图书馆,这真是太棒了。我正在测试它,我认为当未激活的用户尝试登录时会出现问题。我只是想知道你们中是否有人已经注意到这一点?发生的情况是用户被重定向到 send_again 页面,但是一旦到了那里,我们就无法再将 url 更改为任何其他位置。我猜这是因为会话信息没有被破坏 - 在登录功能中:

elseif ($this->tank_auth->is_logged_in(FALSE)) {
// logged in, not activated
redirect('/auth/send_again/'); 

这会一直执行(除非我们强制注销)。有谁知道如何解决这个问题?谢谢!

4

3 回答 3

1

尝试删除 \controllers\auth.php 函数登录上的重定向值并找到以下内容:

elseif (isset($errors['not_activated'])) {              
redirect('');//auth/send_again/ 
}

当您未激活用户时,将始终调用 send_again 函数。因此,要传递 send_again 函数,您只需要删除重定向值

如果要激活电子邮件激活,您需要在配置文件夹中配置 email.php

于 2012-08-27T04:34:44.743 回答
1

我在客户的网站上发现了这个错误。强制注销似乎可以解决它。因此,我在发送激活链接之后,在功能重新发送功能中设置了强制注销。

工作代码在 application/controllers/auth.php 中如下所示

    function send_again()
    {
    if (!$this->tank_auth->is_logged_in(FALSE)) {                           // not logged in or activated
        redirect('/auth/login/');

    } else {
        $this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean|valid_email');

        $data['errors'] = array();

        if ($this->form_validation->run()) {                                // validation ok
            if (!is_null($data = $this->tank_auth->change_email(
                    $this->form_validation->set_value('email')))) {         // success

                $data['site_name']  = $this->config->item('website_name', 'tank_auth');
                $data['activation_period'] = $this->config->item('email_activation_expire', 'tank_auth') / 3600;

                $this->_send_email('activate', $data['email'], $data);

                $this->_display_message(sprintf($this->lang->line('auth_message_activation_email_sent'), $data['email']));

                /* 
                 * Force a logout here or tank_auth remains 
                 * stuck in the resend mode.
                 */ 
                $this->tank_auth->logout();

            } else {
                $errors = $this->tank_auth->get_error_message();
                foreach ($errors as $k => $v)   $data['errors'][$k] = $this->lang->line($v);
            }
.....

据我所知,这只是 hack,但它为我解决了问题。我不知道该站点的创建者是否在 tank_auth 操作中进行了任何更改。

我希望它对其他人有用。

于 2013-03-20T03:11:43.813 回答
0

嘿,这一直对我有用:

if( !$this->tank_auth->is_logged_in() ){
   // not logged in
} else {
   // logged in
}

注意条件的爆炸

于 2011-04-30T18:07:06.783 回答