dimanche 28 février 2016

Laravel user login system

I am using Laravel 5.2. I have an admin panel in my project with login page. User with valid email and password can access. But my code gives me error

ErrorException in UrlGenerator.php line 603:
Action App\Http\Controllers\AdminController@authenticate not defined. (View: E:\xampp\htdocs\blog\resources\views\admin\login.blade.php)

InvalidArgumentException in UrlGenerator.php line 603:
Action App\Http\Controllers\AdminController@authenticate not defined.

Here is my login form:

{!! Form::open(['class' => 'form-horizontal', 'role' => 'form', 'method' => 'post', 'action' => 'AdminController@authenticate']) !!}
                        <fieldset>

                            <div class="input-prepend" title="email">
                                <span class="add-on"><i class="halflings-icon user"></i></span>
                                <input class="input-large span10" name="email" id="email" type="text" placeholder="type email"/>
                            </div>
                            <div class="clearfix"></div>

                            <div class="input-prepend" title="Password">
                                <span class="add-on"><i class="halflings-icon lock"></i></span>
                                <input class="input-large span10" name="password" id="password" type="password" placeholder="type password"/>
                            </div>
                            <div class="clearfix"></div>

                            <label class="remember" for="remember"><input type="checkbox" id="remember" />Remember me</label>

                            <div class="button-login">  
                                <button type="submit" class="btn btn-primary">Login</button>
                            </div>
                            <div class="clearfix"></div>
                        </fieldset>
                    {!! Form::close() !!}

Here is my controller file:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Auth;
use App\Http\Requests;
use App\Http\Controllers\Controller;

class AdminController extends Controller
{
    public function showLogin()
    {
        return view('admin.login');
    }        
    public function authenticate()
    {
        if (Auth::attempt(['email' => $email, 'password' => $password])) {
            // Authentication passed...
            return redirect()->intended('admin.admin_master');
        }
        else {
            return view('admin.login');
        }
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1KU82W5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire