plik routing.php
Route::post('login', function() { //kombinował z tym, ale to nie to //if (Auth::check()) //{ //return View::make('profile')->with('user', //Auth::user()); //} 'email' => Input::get('email'), 'password' => Input::get('password') ); if (Auth::attempt($user)) { return Redirect::to('profile'); } return Redirect::to('login')->with('login_error','Logowanie nie powiodło się.'); });
plik login.php
<!DOCTYPE html> <html> <head> <title>Uwierzytelnianie w Laravelu - logowanie</title> <meta charset="utf-8"> </head> <body> <h2>Uwierzytelnianie w Laravelu - logowanie</h2> <?= '<span style="color:red">' . Session::get('login_error') . '</span>' ?> <?= Form::open() ?> <?= Form::label('email', 'Adres email: ') ?> <?= Form::text('email', Input::old('email')) ?> <br> <?= Form::label('password', 'Hasło: ') ?> <?= Form::password('password') ?> <br> <?= Form::submit('Zaloguj!') ?> <?= Form::close() ?> </body> </html>