php - Laravel admin login isn't working -


admin login don't work , don't give me error.

i have routes in web.php file:

auth::routes();   route::prefix('admin')->group(function () {     route::get('/login','auth\adminlogincontroller@showloginform')->name('admin.login');     route::post('/login','auth\adminlogincontroller@login')->name('admin.login.submit');     route::get('/','admincontroller@getindex')->name('admin.dashboard');     route::get('/logout','auth\adminlogincontroller@logout')->name('admin.logout');     route::post('/password/email','auth\adminforgotpasswordcontroller@sendresetlinkemail')->name('admin.password.email');     route::get('/password/reset','auth\adminforgotpasswordcontroller@showlinkrequestform')->name('admin.password.request');     route::post('/password/reset','auth\adminresetpasswordcontroller@reset');     route::get('/password/reset/{token}','auth\adminresetpasswordcontroller@showresetform')->name('admin.password.reset');  }); 

and functions in controller(i put here have problems)

public function showloginform() {     return view('auth.adminlogin'); } public function login(request $request) {     //validate form data     $this->validate($request, [            'email' => 'required|email',            'password' => 'required|min:6'     ]);     //attempt log user in     if (auth::guard('admin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)){             //if successful, redirect intended location             return redirect('/admin');     }     return redirect()->back()->withinput($request->only('email','remember')); } 

and in resources/views/auth/adminlogin.blade.php have code:

@extends('backend.public.includes.head') <body>     <div class="container">     <div class="row">         <div class="col-md-8 col-md-offset-2">             <div class="panel panel-default">                 <div class="panel-heading">admin login</div>                 <div class="panel-body">                     <form class="form-horizontal" role="form" method="post" action="{{ route('admin.login.submit') }}">                         {{ csrf_field() }}                          <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">                             <label for="email" class="col-md-4 control-label">e-mail address</label>                              <div class="col-md-6">                                 <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>                                  @if ($errors->has('email'))                                     <span class="help-block">                                         <strong>{{ $errors->first('email') }}</strong>                                     </span>                                 @endif                             </div>                         </div>                          <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">                             <label for="password" class="col-md-4 control-label">password</label>                              <div class="col-md-6">                                 <input id="password" type="password" class="form-control" name="password" required>                                  @if ($errors->has('password'))                                     <span class="help-block">                                         <strong>{{ $errors->first('password') }}</strong>                                     </span>                                 @endif                             </div>                         </div>                          <div class="form-group">                             <div class="col-md-6 col-md-offset-4">                                 <div class="checkbox">                                     <label>                                         <input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> remember me                                     </label>                                 </div>                             </div>                         </div>                          <div class="form-group">                             <div class="col-md-8 col-md-offset-4">                                 <button type="submit" class="btn btn-primary">                                     login                                 </button>                                  <a class="btn btn-link" href="{{ route('admin.password.request') }}">                                     forgot password?                                 </a>                             </div>                         </div>                     </form>                 </div>             </div>         </div>     </div> </div> </body> 

this working days ago.. , not, i'm looking don't find error. in networking isn't showing , debug don't see anything.

i try reset password , when reset (i have redirect in function redirect me good, not working in normal login).

errors aren't showed too

edit migrate file:

 public function up()  {         schema::create('admins', function (blueprint $table) {             $table->increments('id');             $table->string('name',50)->unique();             $table->string('email',200)->unique();             $table->string('password');             $table->boolean('public')->default(true);             $table->remembertoken();             $table->timestamps();         });  } 

seed file:

private $arrayadmins = array(         array(             'name' => 'lluis',             'email' => 'lluis.puig@correo.biz',             'password' => 'correo1',             'public' => 1         )     );  public function run()     {         self::seedadmins();     }      public function seedadmins()     {         db::table('admins')->delete();         foreach ($this->arrayadmins $admin)         {             $a = new admin;             $a->name = $admin['name'];             $a->email = $admin['email'];             $a->password = $admin['password'];             $a->public = $admin['public'];             $a->save();         }     } 

the admin login isn't working if created seed. (so problem guess "user created" seed.

i try create 1 php artisan tinker , works.

solved

i check seed. problem de password isn't encrypted!

this line :

$a->password = $admin['password'];

must this:

$a->password = bcrypt($admin['password']);


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -