php - authentication fail in laravel and sentry package -
php - authentication fail in laravel and sentry package -
im trying utilize sentry 2 in new application handle users , groups . after authenticate user sentry , when trying redirect page authentication lost in test code output of check function sentry::check()
true
public function login(){ $credentials = array( 'username' => 'mouad', 'password' => 'test', ); // authenticate user $user = sentry::authenticate($credentials, false); var_dump(sentry::check()); }
session output
array (size=3) '_token' => string 'slaqb8iyyrsppsc1k1a2i8atpkpvklpad3fiqofa' (length=40) 'flash' => array (size=2) 'old' => array (size=0) empty 'new' => array (size=0) empty 'cartalyst_sentry' => array (size=2) 0 => null 1 => string '$2y$08$nwq4rhlacrnykxhqykipj.0c8mr6vk4o364uvatptjz1km1w8kh7k' (length=60)
when tried redirect page after authentication 'cartalyst_sentry' session entry changed , output of check function sentry::check()
false
public function login(){ $credentials = array( 'username' => 'mouad', 'password' => 'test', ); // authenticate user $user = sentry::authenticate($credentials, false); homecoming redirect::to('admin'); } public function admin(){ $data = session::all(); var_dump($data); var_dump(sentry::check()); }
the route configuration simple
route::get('/', 'maincontroller@index'); route::get('create', 'maincontroller@create'); route::get('login', 'maincontroller@login'); route::get('admin', 'maincontroller@admin'); route::get('logout', 'maincontroller@logout');
session configuration default , storage folder writable
you can seek method :
login controller :
public function store() { if (input::get('remember') == "") { $remember = false; } else { $remember = true; } $user = [ 'email' => input::get('email'), 'password' => input::get('password') ]; $login = user::login($user, $remember); }
user model ($login phone call modal user) :
public static function login(array $credentials, $remember) { seek { $user = sentry::finduserbycredentials($credentials); // process login , redirect dashboard page $user->is_logged_in = 1; $user->save(); sentry::login($user, $remember); homecoming \redirect::route('admin.dashboard.index'); } grab (\cartalyst\sentry\users\loginrequiredexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'u moet alle velden in vullen']); } grab (\cartalyst\sentry\users\passwordrequiredexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'u moet het wachtwoordveld invullen']); } grab (\cartalyst\sentry\users\wrongpasswordexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'het opgegeven email/wachtwoord onjuist']); } grab (\cartalyst\sentry\users\usernotfoundexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'het opgegeven email/wachtwoord onjuist']); } grab (\cartalyst\sentry\users\usernotactivatedexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'dit business relationship nog niet geactiveerd']); } grab (\cartalyst\sentry\throttling\usersuspendedexception $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'dit business relationship heeft een timeout']); } grab (\cartakyst\sentry\throttling\userbannedexveption $e) { homecoming \redirect::back()->witherrors(['auth_message' => 'dit business relationship van onze site verbannen']); } }
php laravel laravel-4 sentry
Comments
Post a Comment