I am trying out the sample Sentinel methods. I just want to register a user and authenticate him using his username.
I modified the user table by replacing the email attribute with username and did the migration. Here is my users table.
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username');
$table->string('password');
$table->text('permissions')->nullable();
$table->timestamp('last_login')->nullable();
$table->timestamps();
$table->engine = 'InnoDB';
$table->unique('username');
});
When I try to call the below method to register a sample user, I am getting an error.
Code:
$credentials = [
'username' => 'testuser123',
'password' => '123'
];
$activation = Sentinel::registerAndActivate($credentials);
Error:
InvalidArgumentException in IlluminateUserRepository.php line 271:
No [login] credential was passed.
in IlluminateUserRepository.php line 271
at IlluminateUserRepository->validateUser(array('username' => 'testuser123', 'password' => '123')) in IlluminateUserRepository.php line 154
at IlluminateUserRepository->validForCreation(array('username' => 'testuser123', 'password' => '123')) in Sentinel.php line 164
at Sentinel->register(array('username' => 'testuser123', 'password' => '123'), true) in Sentinel.php line 191
at Sentinel->registerAndActivate(array('username' => 'testuser123', 'password' => '123')) in Sentinel.php line 97
at Sentinel::__callStatic('registerAndActivate', array(array('username' => 'testuser123', 'password' => '123'))) in AuthenticationController.php line 196
at Sentinel::registerAndActivate(array('username' => 'testuser123', 'password' => '123')) in AuthenticationController.php line 196
at AuthenticationController->testFunction()
at call_user_func_array(array(object(AuthenticationController), 'testFunction'), array()) in Controller.php line 246
at Controller->callAction('testFunction', array()) in ControllerDispatcher.php line 162
at ControllerDispatcher->call(object(AuthenticationController), object(Route), 'testFunction') in ControllerDispatcher.php line 107
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 108
at ControllerDispatcher->callWithinStack(object(AuthenticationController), object(Route), object(Request), 'testFunction') in ControllerDispatcher.php line 67
at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\AuthenticationController', 'testFunction') in Route.php line 204
at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134
at Route->run(object(Request)) in Router.php line 701
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Router.php line 703
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 670
at Router->dispatchToRoute(object(Request)) in Router.php line 628
at Router->dispatch(object(Request)) in Kernel.php line 214
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 141
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in ShareErrorsFromSession.php line 55
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 61
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 36
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 40
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 42
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 125
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 101
at Pipeline->then(object(Closure)) in Kernel.php line 115
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 84
at Kernel->handle(object(Request)) in index.php line 53
at require_once('/home/pranavaghanan/Documents/GitHub Projects/To Integrate For Release 1/SEP/public/index.php') in server.php line 21
Is there any way to correct the problem? Thanks.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1JDFSaj
via IFTTT
Aucun commentaire:
Enregistrer un commentaire