使用Ion Auth和Facebook登录的PHP登录在MAMP本地工作,但不能在Web服务器上工作



我面临的问题是手动新用户订阅在本地工作,但在远程 Web 服务器上不起作用。非工作版和工作版之间的唯一区别是我将 Ion Auth 升级到版本 2,并为 Facebook 登录添加了 Facebook-Ion Auth 库。

同样,它在本地完美运行,但在 Web 服务器上则不然。PHP 版本已经过测试,工作正常。

这是它卡住的控制器(显示空白页或返回主页(。

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Signup extends CI_Controller {
    function __construct()
    {
        parent::__construct();
        $this->CI =& get_instance();
        $this->load->library('form_validation');
        $this->load->helper('url');
        $this->load->library('forms/signupform');
        $this->form_validation->set_error_delimiters(
                        $this->config->item('error_start_delimiter', 'ion_auth'),
                        $this->config->item('error_end_delimiter', 'ion_auth')
                );
    }
    /**
     * @signup page of freelancer
     */
    public function index()
    {
        $data['title']  = lang('title_registration');
        $data['bodyclass'] = 'hold-transition register-page';
        $data['js_bottom_files'] = array('plugins/iCheck/icheck.min', 'js/custom');
        $data['cssfiles'] = array('plugins/iCheck/square/blue');
        // POST SIGNUP FORM
        if ('POST' == $this->input->server('REQUEST_METHOD')  && $this->input->post('registersubmit') ) {
            // Signup Action
            $data['message_success'] = $this->signup();
        }
        // $user['checked'] = '';
        // if ($this->input->post('agree') == 'yes') {
        //  $user['checked'] = 'checked';
        // }
        $data['form'] = $this->signupform->view($user);
        //Render Or redirect according to User AccessLevel
        if (!$this->ion_auth->logged_in()) {
            $this->template->load('layout', 'home', $data);
        } elseif ($this->ion_auth->is_admin()) {
            redirect(site_url('admin/dashboard'), 'refresh');
        } elseif ($this->ion_auth->is_members()) {
            redirect(site_url('note/create'), 'refresh');
        }
    }
    /**
     * @Signup action for user
     */
    public function signup()
    {
        $this->form_validation->set_rules('email', 'Email', 'required|valid_email');
        // $this->form_validation->set_rules('full_name', lang('label_full_name'), 'required');
        $this->form_validation->set_rules('loginPassword', lang('label_signup_createpassword'), 'required|min_length['.$this->config->item('min_password_length', 'ion_auth').']|max_length['.$this->config->item('max_password_length', 'ion_auth').']');
        // $this->form_validation->set_rules('confirmpassword', lang('label_signup_confirmpassword'), 'required');
        // $this->form_validation->set_rules('agree', 'Agree', 'required');
        if ($this->form_validation->run() == true) {
            $email    = $this->input->post('email');
            $password = $this->input->post('loginPassword');
            // $additional_data = array('first_name' => $this->input->post('full_name'), 'school' => $this->input->post('school_name'));
            $group_ids = array( 'user_groups' => 2);
            if ($this->ion_auth->register($email, $password, $email, $additional_data, $group_ids)) {
                //check to see if we are creating the user
                //$this->session->set_flashdata('message_success', $this->ion_auth->messages());
                //redirect(site_url('/'), 'refresh');
                if($this->ion_auth->login($email, $password)){
                    redirect(site_url('note/create'), 'refresh');
                }
            } else {
                $this->session->set_flashdata('message_error', $this->ion_auth->errors());
                redirect(site_url('/'), 'refresh');
            }
        }
    }
}
/* End of file signup.php */

如果没有更多信息,可能不是问题,但是:

$group_ids = array( 'user_groups' => 2);应该只是$group_ids = array('2')

在此处查看寄存器功能的用法。

在 Ion auth 配置文件中,$config['identity']应设置为电子邮件(如果您尚未这样做(。

最新更新