Support the ongoing development of Laravel.io →
posted 10 years ago
Authentication

I am trying to get my brain around Laravel by trying to follow the tutorial here http://alexsears.com/tutorial/create-admin-interface-laravel

I followed everything specifically and even copied the code from github and still have this issue. I go to the login page and no matter what I put in, it just redirects to that page. No errors, no login, etc. I believe it may be a routeing issue but this newb can't figure it out.

Any help would be appreciated.

index.blade.php

@extends('layouts.master')

@section('title') Login @stop

@section('content')

<div class='col-lg-4 col-lg-offset-4'>

    @if ($errors->has())
        @foreach ($errors->all() as $error)
            <div class='bg-danger alert'>{{ $error }}</div>
        @endforeach
    @endif

    <h1><i class='fa fa-lock'></i> Login</h1>

    {{ Form::open(['role' => 'form']) }}

    <div class='form-group'>
        {{ Form::label('username', 'Username') }}
        {{ Form::text('username', null, ['placeholder' => 'Username', 'class' => 'form-control']) }}
    </div>

    <div class='form-group'>
        {{ Form::label('password', 'Password') }}
        {{ Form::password('password', ['placeholder' => 'Password', 'class' => 'form-control']) }}
    </div>

    <div class='form-group'>
        {{ Form::submit('Login', ['class' => 'btn btn-primary']) }}
    </div>

    {{ Form::close() }}

</div>

@stop

HomeController.php

<?php

class HomeController extends BaseController {

	public function getIndex()
	{
		return View::make('home.index');
	}

	public function postIndex()
	{
		$username = Input::get('username');
		$password = Input::get('password');

		if (Auth::attempt(['username' => $username, 'password' => $password]))
		{
			return Redirect::intended('/user');
		}

		return Redirect::back()
			->withInput()
			->withErrors('That username/password combo does not exist.');
	}

	public function getLogin()
	{
		return Redirect::to('/');
	}

	public function getLogout()
	{
		Auth::logout();

		return Redirect::to('/');
	}

}

routes.php

<?php

Route::resource('/user', 'UserController');
Route::controller('/', 'HomeController');
Last updated 3 years ago.
0

in index.blade.php write

{{ Form::open(array('route' => 'login.index', 'role' => 'form')) }}

in routes.php write

Route::get('login', array('as' => 'login.index', 'uses' => 'LoginController@getIndex'));
Route::post('login', array('as' => 'login.entry', 'uses' => 'LoginController@postIndex'));

Maybe something messed up rewriting of their projects.
Error in the properties form is not specified route.
Error in routes.php not indicated what function to call in the controller to your rule.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

kirchaj kirchaj Joined 1 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.