php - Laravel Authentication -
hello trying basic authentication.
view
<!-- simple login form --> {!! form::open(array('url' => '/auth/login')) !!} <div class="panel panel-body login-form"> <div class="text-center"> <div class="icon-object border-slate-300 text-slate-300"><i class="icon-reading"></i></div> <h5 class="content-group">login account <small class="display-block">enter credentials below</small></h5> </div> @if($errors->any()) <div class="alert alert-danger no-border"> username or password have entered incorrect </div> @endif <div class="form-group has-feedback has-feedback-left"> {{form::text('username', null, array('class'=>'form-control', 'placeholder'=>'username'))}} <div class="form-control-feedback"> <i class="icon-user text-muted"></i> </div> </div> <div class="form-group has-feedback has-feedback-left"> {{form::password('password', array('class'=>'form-control', 'placeholder'=>'password'))}} <div class="form-control-feedback"> <i class="icon-lock2 text-muted"></i> </div> </div> <div class="form-group"> <button type="submit" class="btn btn-primary btn-block">sign in <i class="icon-circle-right2 position-right"></i></button> </div> <div class="text-center"> <a href="login_password_recover.html">forgot password?</a> </div> </div> {!! form::close() !!} <!-- /simple login form -->
routes
route::get('auth/login', 'auth\authcontroller@getlogin'); route::post('auth/login', 'auth\authcontroller@postlogin'); route::get('auth/logout', 'auth\authcontroller@getlogout'); route::get('auth/register', 'auth\authcontroller@getregister'); route::post('auth/register', 'auth\authcontroller@postregister') ;
but getting following error
undefined variable: errors
i didn't change else, want basic authentication. please me. else did miss?
make sure $middleware[];
array in app/http/kernel.php
have following middleware registered:
\illuminate\view\middleware\shareerrorsfromsession::class,
alternatively, can try registering routes of authentication under web
middleware, such that:
route::group(['middleware' => ['web']], function () { route::get('auth/login', 'auth\authcontroller@getlogin'); route::post('auth/login', 'auth\authcontroller@postlogin'); route::get('auth/logout', 'auth\authcontroller@getlogout'); route::get('auth/register', 'auth\authcontroller@getregister'); route::post('auth/register', 'auth\authcontroller@postregister'); }
i hope work.
Comments
Post a Comment