2017-02-12 1 views
0

웨더 내가 제출 한 로그인, 등록 또는 잊어 버린 암호 양식 POST 데이터를 검색 할 수 없습니다. 이 내 폼 태그 동안 :인증 후 POST 데이터를 검색하는 방법은 무엇입니까?

<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}"> 

/login 그래서 나는 그것이 다시 현재 페이지로 리디렉션됩니다 같은데요에서 끝나지 않습니다. 어떻게하면이 데이터를 검색 할 수 있습니까?

내 목표는 사람이 등록/로그인/잊어 버린 암호 양식을 사용했는지 또는 실패했는지 또는 성공했는지 여부를 확인하는 것입니다. (그들은 다른 조동사의 같은 페이지에 있습니다)

편집 :

내 컨트롤러 :

<?php 

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 
use App\Blog; 
use App\Account; 
use Illuminate\Foundation\Auth; 
use Illuminate\Support\Facades\Input; 

class HomeController extends Controller 
{ 
    /** 
    * Create a new controller instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     //$this->middleware('auth'); 
    } 

    /** 
    * Show the application dashboard. 
    * 
    * @return \Illuminate\Http\Response 
    */ 
    public function index(Request $request) 
    { 
     $blogItems = Blog::all(); 
     $onlinePlayers = Account::getOnlinePlayers()->count(); 
     $onlineStaff = Account::getOnlineStaff()->count(); 
     $input = Request('username'); 
     return Auth::routes(); 
    } 
} 

로그인 양식 :

   <form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}"> 
        {{ csrf_field() }} 

        <div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}"> 
         <label for="username" class="col-md-4 control-label">Username</label> 

         <div class="col-md-6"> 
          <input id="username" type="text" class="form-control" name="username" value="{{ old('username') }}" required autofocus> 

          @if ($errors->has('username')) 
           <span class="help-block"> 
            <strong>{{ $errors->first('username') }}</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="{{ url('/password/reset') }}"> 
           Forgot Your Password? 
          </a> 
         </div> 
        </div> 
       </form> 

내 경로가 :

<?php 

/* 
|-------------------------------------------------------------------------- 
| Web Routes 
|-------------------------------------------------------------------------- 
| 
| Here is where you can register web routes for your application. These 
| routes are loaded by the RouteServiceProvider within a group which 
| contains the "web" middleware group. Now create something great! 
| 
*/ 

//Auth 
Auth::routes(); 

//Homepage 
Route::get('/', '[email protected]'); 
Route::get('/home', '[email protected]'); 
Route::get('/logout', '\App\Http\Controllers\Auth\[email protected]'); 

LoginController :

<?php 

namespace App\Http\Controllers\Auth; 

use \Auth; 
use App\Http\Controllers\Controller; 
use Illuminate\Foundation\Auth\AuthenticatesUsers; 
use Illuminate\Auth\Authenticatable; 
use Illuminate\Http\Request; 
use App\Account; 

class LoginController extends Controller 
{ 
    /* 
    |-------------------------------------------------------------------------- 
    | Login Controller 
    |-------------------------------------------------------------------------- 
    | 
    | This controller handles authenticating users for the application and 
    | redirecting them to your home screen. The controller uses a trait 
    | to conveniently provide its functionality to your applications. 
    | 
    */ 

    use AuthenticatesUsers; 

    /** 
    * Where to redirect users after login. 
    * 
    * @var string 
    */ 
    protected $redirectTo = '/home'; 

    /** 
    * Create a new controller instance. 
    * 
    * @return void 
    */ 
    public function __construct() 
    { 
     $this->middleware('guest', ['except' => 'logout']); 
    } 

    /** 
    * Override the username method used to validate login 
    * 
    * @return string 
    */ 
    public function username() 
    { 
     return 'username'; 
    } 
} 
+0

당신의 루트 파일에 무엇 :

<input type="text" name="username"/><br/> <input type="password" name="password"/><br/> 

그런 다음 컨트롤러 액션 내에서 다음 명령을 사용합니다 '/ login' 경로에 대해? – Jerodev

+0

내 컨트롤러에'Auth :: routes();'가 정의되어 있어야합니다. –

+0

나는 당신의 문제가 무엇인지 파악하기 위해 조금 더 많은 코드를 볼 필요가 있다고 생각한다. – dargue3

답변

1

확실히 할 수 있습니다. 다음과 같은 명령을 통해 로그인 데이터를 검색 할 수 있습니다 :

당신의 HTML이

경우

string username = Request["username"]; 
string password = Request["password"]; 
+0

그건 작동하지 않는다. 상수가 존재하지 않는다고합니다. 대신'$ request'를 사용하면 그 값은 비어 있습니다. 요청 ('username')도 마찬가지입니다. –

관련 문제