Anahkiasen / flatten

A package to flatten any website to plain HTML
336 stars 42 forks source link

Kickstarter only for non logged in users #23

Closed andrewpros closed 9 years ago

andrewpros commented 10 years ago

Can someone tell me how to use kickstarter method, but only for non logged in users?

The issue is that with kickstarter it doesn't check the config and as it don't use laravel there is no simple way to Auth::check()

Can someone help me with this?

Anahkiasen commented 10 years ago

If you do 'blocked' => [Auth::check()] in the config that doesn't work ?

andrewpros commented 10 years ago

Haven't tested it till now, coz, when you use kickstarter the code clearly shows that it doesn't even load config.

There is also problem with this, if someone go to page, cache is created, but then he log in, the cache show non logged in page, so i clearly need a way to check login status, but...

If i use kickstarter in autoload.php it won't work, so i'm looking for a solution.

Going back to your question, adding Auth::check to blockers array in config just gets me a long, long error...

Please keep in mind, i'm using the kickstarter method, laravel has a very very low performance, so i need to use it.

Anahkiasen commented 10 years ago

Ah yeah no yeah confused with something else. I think I did that once, checking auth during kickstart, by checking the cookie or session or something but I'm not sure that still works on 4.2

iGeckoDev commented 10 years ago

It might be too late to help, but I just got this working.

In the config.php file you need to put: 'blockers' => array(Auth::guest()),

Then have your Laravel app create a new cookie on login (and delete on logout). You can then use the following code in autoload.php:

if (!isset($_COOKIE["cookiename"])) { require DIR.'/../vendor/anahkiasen/flatten/src/Flatten/Flatten.php'; Flatten\Flatten::kickstart(); }