📜  CODEIGNITER codeigniter 4 auth - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:29.945000             🧑  作者: Mango

代码示例1
exists($_POST['email'], $_POST['password']) != NULL) {
            $session = session();
            $session->set('email', $_POST['email']);
            return $this->response->redirect(site_url('signin/profile'));
        } else {
            $data['msg'] = 'wrong';
            return view('signin', $data);
        }
    }

    public function profile() {
        return view('signin/profile');
    }

    private function exists($email, $password) {
        $model = new Users_model();
        $account = $model->where('email', $email)->first();
        if ($account != NULL) {
            if (password_verify($password, $account['password'])) {
                return $account;
            }
        }
        return NULL;
    }

}