duandang2123 2016-02-16 08:37
浏览 45

存储令牌和用户ID以重置密码

When someone clicks on forget password I am calling this function now.

 public function reset_password($token){
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->form_validation->set_rules('email', 'Email', 'required|min_length[5]|max_length[100]|valid_email|xxs_clean');
       //if email is not right through them back
        if ($this->form_validation->run() == FALSE) {
            $this->load->view('header');
            $this->load->view('forgot_password_view');
            $this->load->view('footer');
        }else{
            $email = $this->input->post('email');
            // Verify the username is not in use already.
            $userid = $this->myajax->getUserByAuth($token);
            $result = $this->user_profile->IsUsernameInUse($email, $userid);
            $data = array(
                'userid' => $userid,
                'token' => $token,
                'expiration' => date('Y-m-d')

            );
            $this->db->insert('reset_password', $data);
            //$this->send_reset_password_email($email, $result);
            $this->load->view('header');
            $this->load->view('reset_password_sent_view', array('email'=> $email));
            $this->load->view('footer');


        }
    }

My problem is that the token is expired, because a new token is generated for the user. A new token is generated every time an ordinary www call is made. I need a way to change logic and save the token that I will send the user via email in a new support table alongside with the user's ID and the expiration time stamp for the token, and the expiration time stamp I am not sure how to add 15 minutes more.

This are the errors I get. enter image description here

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度