Laravel 4登录无效

时间:2014-06-12 15:05:28

标签: php login laravel

如果我尝试登录我只是得到这个网址:

http://xx.xx.xx.xx/game/public/?_token=4kXP1sYlLIizUUMyMWluK6jSEOacDikXafUSVrIF&username=dieter&password=azerty

我可能做了一些愚蠢的事。这是我的代码:

控制器:

public function postSignin() {
        if (Auth::attempt(array('username'=>Input::get('username'), 'password'=>Input::get('password')))) {
            return Redirect::to('users/dashboard')
                ->with('message', 'You are logged in');
        } else {
            return Redirect::to('index')
                ->with('message', 'Your username/password combination was incorrent.')
                ->withInput();
        }
    }

登录表单:

{{Form::open(array('url'=>'users/signin')) }}
                    {{ Form::text('username', null, array('class' => 'input-block-level', 'placeholder' => 'Username')) }}
                    {{ Form::password('password', null, array('class' => 'input-block-level', 'placeholder' => 'Password')) }}

                    {{ Form::submit('Login', array('class' => 'btn btn-default')) }}
                    {{ Form::close() }}  

路线:

<?php
Route::controller('users', 'UsersController');
Route::controller('/', 'HomeController');

它忽略了“网址”。在登录表单中。如果我将其更改为其他内容,它只会以相同的方式响应。

我一整天都在谷歌上搜索,所以请帮忙。 ^^

由于

1 个答案:

答案 0 :(得分:0)

您有一个没有action属性的表单,您的提交按钮会将您转到同一页面。尝试将Form声明更改为:

{{ Form::open(array('route' => 'users/signin') ) }}

我希望这很好用。