I'm using Laravel 5.2, with a fresh Sentinel 2.0 installation, registering works fine, but attempting to login returns the user, but does not set any cookie or session or whatsoever..
At this moment I've found that no cookie/session is saved whatsoever. I can't really figure out as to why the cookie is not pushed.
AuthController.php
namespace App\Modules\Auth\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AuthController extends Controller {
public function getLogin() {
return view("Auth::login");
}
public function postLogin(Request $request) {
$credentials = [
'email' => $request->input('login_email'),
'password' => $request->input('login_password'),
];
if (\Sentinel::authenticate($credentials)) {
return redirect('core/dashboard');
}
}
}
\Sentinel::check();
var_dump() before redirect
object(Cartalyst\Sentinel\Users\EloquentUser)#188 (27) {
["table":protected]=>
string(5) "users"
["fillable":protected]=>
array(5) {
[0]=>
string(5) "email"
[1]=>
string(8) "password"
[2]=>
string(9) "last_name"
[3]=>
string(10) "first_name"
[4]=>
string(11) "permissions"
}
["persistableKey":protected]=>
string(7) "user_id"
["persistableRelationship":protected]=>
string(12) "persistences"
["loginNames":protected]=>
array(1) {
[0]=>
string(5) "email"
}
["connection":protected]=>
NULL
["primaryKey":protected]=>
string(2) "id"
["perPage":protected]=>
int(15)
["incrementing"]=>
bool(true)
["timestamps"]=>
bool(true)
["attributes":protected]=>
array(9) {
["id"]=>
int(1)
["email"]=>
string(25) "test@dev.local"
["password"]=>
string(60) "$2y$10$wXHwd6ubbHWWXU9CBI/7AOdDsHY.f7t8b1Kjem0m1ep7Ud.9M/4i6"
["permissions"]=>
NULL
["last_login"]=>
object(Carbon\Carbon)#192 (3) {
["date"]=>
string(26) "2016-01-06 15:15:42.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
Any ideas what can go wrong?
in .env
the session driver is set to database
, and the sessions table stays empty after login. No cookie is set either.
Had the same issue. I had to create a route group with the web middleware
Route::group(['middleware' => 'web'], function() {
Route::get('modules', ['uses' => 'ModuleController@index', 'as' => 'modules']);
Route::get('modules/{name}', ['uses' => 'ModuleController@show', 'as' => 'modules.show']);
Route::post('modules/{module}/publish', ['as' => 'module.publish', 'uses' => 'ModuleController@publish']);
Route::post('modules/{module}/enable', ['as' => 'module.enable', 'uses' => 'ModuleController@enable']);
Route::post('modules/{module}/disable', ['as' => 'module.disable', 'uses' => 'ModuleController@disable']);
});
Worked as expected then.