Merhaba,
Sentry ile giriş yapmaya çalıştığımda kullanıcıyı bulamıyor. Gerçekten sebebini anlayamadım. Herşey normal başka bir hata almıyorum.
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function()
{
return View::make('hello');
});
Route::get('panel/register', 'HomeController@getRegister');
Route::get('panel/login', 'HomeController@getLogin');
Route::post('panel/login', 'HomeController@postLogin');
Route::any('panel/logout', 'HomeController@logout');
Route::post('panel/register', 'HomeController@postRegister');
Route::group(array('before' => 'auth'), function(){
Route::get('panel/index', 'AdminController@index');
Route::get('logout', 'HomeController@logout');
});
Route::get('/', function()
{
return View::make('panel.admin.index');
});
<?php
class HomeController extends BaseController {
/*
|--------------------------------------------------------------------------
| Default Home Controller
|--------------------------------------------------------------------------
|
| You may wish to use controllers instead of, or in addition to, Closure
| based routes. That's great! Here is an example controller method to
| get you started. To route to this controller, just add the route:
|
| Route::get('/', 'HomeController@showWelcome');
|
*/
public function showWelcome()
{
return View::make('hello');
}
public function getRegister()
{
return View::make('admin.register');
}
public function getLogin()
{
return View::make('panel.login');
}
public function postRegister()
{
try
{
$user = Sentry::createUser(array(
'username' => Input::get('username'),
'first_name' => Input::get('first_name'),
'last_name' => Input::get('last_name'),
'email' => Input::get('email'),
'password' => Input::get('password'),
'activated' => true,
));
}
catch (Cartalyst\Sentry\Users\UserExistsException $e)
{
echo 'User Already Exists';
}
}
public function postLogin()
{
$credentials = array(
'username' => Input::get('username'),
'password' => Input::get('password')
);
try{
/*$user = Sentry::authenticate($credentials, false);
if($user)
{
return Redirect::to('panel/index');
}*/
$user = Sentry::authenticate($credentials);
var_dump('başarılı');
if($user)
{
return Redirect::to('panel/index');
}
}
catch(Cartalyst\Sentry\Users\LoginRequiredException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Lütfen giriş bilgilerini doldurunuz!'));
}
catch(Cartalyst\Sentry\Users\PasswordRequiredException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Lütfen şifrenizi giriniz!'));
}
catch(Cartalyst\Sentry\Users\UserNotActivatedException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Hesabınız aktif değil!'));
}
catch(Cartalyst\Sentry\Throttling\UserSuspendedException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Hesabınız askıya alındı!'));
}
catch(Cartalyst\Sentry\Throttling\UserBannedException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Hesabınız banlanmış!'));
}
catch(Cartalyst\Sentry\Users\UserNotFoundException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Böyle bir kullanıcı bulunamadı!'));
}
catch(Cartalyst\Sentry\Users\WrongPasswordException $e)
{
return Redirect::to('panel/login')->withErrors(array('login' => 'Şifreniz yanlış!'));
}
}
public function logout()
{
Sentry::logout();
return Redirect::to('panel/login');
}
}
<?php
/**
* Part of the Sentry package.
*
* NOTICE OF LICENSE
*
* Licensed under the 3-clause BSD License.
*
* This source file is subject to the 3-clause BSD License that is
* bundled with this package in the LICENSE file. It is also available at
* the following URL: http://www.opensource.org/licenses/BSD-3-Clause
*
* @package Sentry
* @version 2.0.0
* @author Cartalyst LLC
* @license BSD License (3-clause)
* @copyright (c) 2011 - 2013, Cartalyst LLC
* @link http://cartalyst.com
*/
return array(
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This drivers manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "eloquent" (more coming soon).
|
*/
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Default Hasher
|--------------------------------------------------------------------------
|
| This option allows you to specify the default hasher used by Sentry
|
| Supported: "native", "bcrypt", "sha256", "whirlpool"
|
*/
'hasher' => 'sha256',
/*
|--------------------------------------------------------------------------
| Cookie
|--------------------------------------------------------------------------
|
| Configuration specific to the cookie component of Sentry.
|
*/
'cookie' => array(
/*
|--------------------------------------------------------------------------
| Default Cookie Key
|--------------------------------------------------------------------------
|
| This option allows you to specify the default cookie key used by Sentry.
|
| Supported: string
|
*/
'key' => 'eteknik_cookie',
),
/*
|--------------------------------------------------------------------------
| Groups
|--------------------------------------------------------------------------
|
| Configuration specific to the group management component of Sentry.
|
*/
'groups' => array(
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver, we need to know which
| Eloquent models should be used throughout Sentry.
|
*/
'model' => 'Cartalyst\Sentry\Groups\Eloquent\Group',
),
/*
|--------------------------------------------------------------------------
| Users
|--------------------------------------------------------------------------
|
| Configuration specific to the user management component of Sentry.
|
*/
'users' => array(
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver, we need to know which
| Eloquent models should be used throughout Sentry.
|
*/
'model' => 'Cartalyst\Sentry\Users\Eloquent\User',
/*
|--------------------------------------------------------------------------
| Login Attribute
|--------------------------------------------------------------------------
|
| If you're using the "eloquent" driver and extending the base Eloquent
| model, we allow you to globally override the login attribute without
| even subclassing the model, simply by specifying the attribute below.
|
*/
'login_attribute' => 'username',
),
/*
|--------------------------------------------------------------------------
| User Groups Pivot Table
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver, you can specify the table name
| for the user groups pivot table.
|
| Default: users_groups
|
*/
'user_groups_pivot_table' => 'users_groups',
/*
|--------------------------------------------------------------------------
| Throttling
|--------------------------------------------------------------------------
|
| Throttling is an optional security feature for authentication, which
| enables limiting of login attempts and the suspension & banning of users.
|
*/
'throttling' => array(
/*
|--------------------------------------------------------------------------
| Throttling
|--------------------------------------------------------------------------
|
| Enable throttling or not. Throttling is where users are only allowed a
| certain number of login attempts before they are suspended. Suspension
| must be removed before a new login attempt is allowed.
|
*/
'enabled' => false,
/*
|--------------------------------------------------------------------------
| Model
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver, we need to know which
| Eloquent models should be used throughout Sentry.
|
*/
'model' => 'Cartalyst\Sentry\Throttling\Eloquent\Throttle',
/*
|--------------------------------------------------------------------------
| Attempts Limit
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver and extending the base Eloquent model,
| you have the option to globally set the login attempts.
|
| Supported: int
|
*/
'attempt_limit' => 5,
/*
|--------------------------------------------------------------------------
| Suspension Time
|--------------------------------------------------------------------------
|
| When using the "eloquent" driver and extending the base Eloquent model,
| you have the option to globally set the suspension time, in minutes.
|
| Supported: int
|
*/
'suspension_time' => 1,
),
);
kodlarım yukarıdaki şekildedir. Veritabanına username diye bir kolon ekledim onunla kontrol sağlatıyorum. Teşekkürler.