Laravel form displayed as raw text - laravel

My problem is probably related to server configuration problem. This is the issue. I am developing a Laravel website that works fine when developing on my local machine (using the laradock docker environment).
I wanted to run it on a small local machine so I turned on a fresh Ubuntu 16.04 server and installed docker on it. Checked out my code and ran composer install.
After going to the main registration page, I see that parts of the registration form are displayed as raw text :
I don't see any errors when using the developers page and also no errors in the php-fpm, workspace or nginx container from laradock that hosts the website.
Any idea?
code:
<?php
$ip = get_ip_address();
$countries = [
"Afghanistan" => "Afghanistan",
"Albania" => "Albania",
"Zimbabwe" => "Zimbabwe"
];
?>
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Register</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ route('register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</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">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>
<div class="form-group">
<label for="country" class="col-md-4 control-label">Select your country</label>
<div class="col-md-6">
{{Form::select("country", $countries, null, ['type' => 'text','class' => 'form-control','placeholder' => 'Pick your country...'])}}
</div>
#if ($errors->has('country'))
<span class="help-block">
<strong>{{ $errors->first('country') }}</strong>
</span>
#endif
</div>
{{ Form::hidden('ip', $ip) }}
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
<?php
function get_ip_address() {
// check for shared internet/ISP IP
if (!empty($_SERVER['HTTP_CLIENT_IP']) && validate_ip($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
}
// check for IPs passing through proxies
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// check if multiple ips exist in var
if (strpos($_SERVER['HTTP_X_FORWARDED_FOR'], ',') !== false) {
$iplist = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
foreach ($iplist as $ip) {
if (validate_ip($ip))
return $ip;
}
} else {
if (validate_ip($_SERVER['HTTP_X_FORWARDED_FOR']))
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
if (!empty($_SERVER['HTTP_X_FORWARDED']) && validate_ip($_SERVER['HTTP_X_FORWARDED']))
return $_SERVER['HTTP_X_FORWARDED'];
if (!empty($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']) && validate_ip($_SERVER['HTTP_X_CLUSTER_CLIENT_IP']))
return $_SERVER['HTTP_X_CLUSTER_CLIENT_IP'];
if (!empty($_SERVER['HTTP_FORWARDED_FOR']) && validate_ip($_SERVER['HTTP_FORWARDED_FOR']))
return $_SERVER['HTTP_FORWARDED_FOR'];
if (!empty($_SERVER['HTTP_FORWARDED']) && validate_ip($_SERVER['HTTP_FORWARDED']))
return $_SERVER['HTTP_FORWARDED'];
// return unreliable ip since all else failed
return $_SERVER['REMOTE_ADDR'];
}
?>

All the values echoed with {{ }} are sent through the htmlentities function of PHP. If you want to skip that, than you should use another notation:
{!! $unescaped_html !!}
Source

Related

Laravel 8 How to restrict user login if email is not verified

I am using Bootstrap Starter template package in Laravel 8 that replaces Tailwind CSS framework with Bootstrap CSS framework.
https://packagist.org/packages/shahvirag/laravel-ui-bootstrap
The problem I'm having is that user can sign in after registration without needing to verify account through email. How can I restrict his access until the email is not verified?
I have followed the steps and tried using routes middleware, but there is no such file in App\Http\Controllers\PagesController;
Route::get('/',[PagesController::class, 'index'])->name('users')->middleware('verified'); // this does not work
Any help?
routes/web.php
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\PagesController;
Route::get('/', function () {
return view('main');
});
Route::middleware(['auth'])->group(function() {
Route::get('/home', function() {
return view('home');
})->name('home');
Route::get('/user/profile', function() {
return view('profile');
})->name('profile');
});
Route::get('/',[PagesController::class, 'index'])->name('users')->middleware('verified');
resources/views/auth/login.blade.php
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Login') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('login') }}">
#csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control #error('password') is-invalid #enderror" name="password" required autocomplete="current-password">
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<div class="col-md-6 offset-md-4">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
</label>
</div>
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Login') }}
</button>
#if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
</a>
#endif
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
To use verified middleware, your user model should implement MustVerifyEmail
class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
// ...
}
Try this instead
Route::get('/',[PagesController::class, 'index'])->name('users')->middleware(['auth', 'verified']);
You can use the method included with the User model:
$user->hasVerifiedEmail()
Or in the routes middleware(['verified'])

How to show data after user click an option from drop down list?

I want to show the data after user have selected the project.
I've tried several method but none of them can show the next data.
I want to create as simple as when user choose a project, it'll show the next question such as select product, select period, etc.
this is my form.blade.php
#extends('layouts.master')
#section('style')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<link rel="stylesheer" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style type="text/css">
.box{
width:600px;
margin:0 auto;
border:1[x solid #ccc;]
}
</style>
#endsection
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Add Prospect</div>
<form action="{{ url('/add/outlet') }}" method="post" enctype="multipart/form-data">
#csrf
<div class="card-body">
<div class="form-group">
<select name="project_name" id="project" class="form-control input-lg dynamic" data-dependent="product">
<option value="">Select Project</option>
#foreach($project_list as $project)
<option value="{{$project->project}}"> {{$project->project}} </option>
#endforeach
</select>
</div>
<div class="form-group">
<select name="product_name" id="product" class="form-control input-lg">
<option value="">Select Product</option>
<option value="HelloBill Retail">HelloBill Retail</option>
<option value="HelloBill FNB">HelloBill FNB</option>
</select>
</div>
<div class="form-group">
<select name="period" id="period" class="form-control input-lg">
<option value="">Select Period</option>
<option value="Bulanan">Bulanan</option>
<option value="Tahunan">Tahunan</option>
</select>
</div>
<div class="form-group row">
<label for="outlet" class="col-md-4 col-form-label text-md-left">Outlet</label>
<div class="col-md-8">
<input id="outlet" type="text" class="form-control{{ $errors->has('outlet') ? ' is-invalid' : '' }}" name="outlet" value="{{ old('outlet') }}" required autofocus>
#if ($errors->has('outlet'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('outlet') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="alamat" class="col-md-4 col-form-label text-md-left">Alamat</label>
<div class="col-md-8">
<input id="addressLine1" type="text" class="form-control{{ $errors->has('addressLine1') ? ' is-invalid' : '' }}" name="addressLine1" value="{{ old('addressLine1') }}" placeholder="Address Line #1" required autofocus>
#if ($errors->has('addressLine1'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('addressLine1') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="addressLine2" type="text" class="form-control" name="addressLine2" value="{{ old('addressLine2') }}" placeholder="Address Line #2" required autofocus>
</div>
</div>
<div class="form-group row">
<label for="kelurahan" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="kelurahan" type="text" class="form-control{{ $errors->has('kelurahan') ? ' is-invalid' : '' }}" name="kelurahan" value="{{ old('kelurahan') }}" placeholder="Kelurahan" required autofocus>
#if ($errors->has('kelurahan'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('kelurahan') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="kecamatan" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="kecamatan" type="text" class="form-control{{ $errors->has('kecamatan') ? ' is-invalid' : '' }}" name="kecamatan" value="{{ old('kecamatan') }}" placeholder="Kecamatan" required autofocus>
#if ($errors->has('kecamatan'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('kecamatan') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="kota" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="kota" type="text" class="form-control{{ $errors->has('kota') ? ' is-invalid' : '' }}" name="kota" value="{{ old('kota') }}" placeholder="Kota" required autofocus>
#if ($errors->has('kota'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('kota') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="provinsi" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="provinsi" type="text" class="form-control{{ $errors->has('provinsi') ? ' is-invalid' : '' }}" name="provinsi" value="{{ old('provinsi') }}" placeholder="Provinsi" required autofocus>
#if ($errors->has('provinsi'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('provinsi') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="zipCode" class="col-md-4 col-form-label text-md-left"></label>
<div class="col-md-8">
<input id="zipCode" type="text" class="form-control{{ $errors->has('zipCode') ? ' is-invalid' : '' }}" name="zipCode" value="{{ old('zipCode') }}" placeholder="Kode Pos" required autofocus>
#if ($errors->has('zipCode'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('zipCode') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="PIC" class="col-md-4 col-form-label text-md-left">PIC</label>
<div class="col-md-8">
<input id="PIC" type="text" class="form-control{{ $errors->has('PIC') ? ' is-invalid' : '' }}" name="PIC" value="{{ old('PIC') }}" required autofocus>
#if ($errors->has('PIC'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('PIC') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-left">Email</label>
<div class="col-md-8">
<input id="email" type="text" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="email" value="{{ old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
Add
</button>
</div>
</div>
#if($errors->any())
<div class="category-msg-error">{{ $errors->first() }}</div>
#endif
</div>
</form>
</div>
</div>
</div>
</div>
#endsection
#section('extra')
<script>
$(document).ready(function(){
$('.dynamic').change(function(){
if($(this).val()!=''){
var select = $(this).attr("id");
var value = $(this).val();
var dependent = $(this).data('dependent');
var __token = $('input[name=_token"]').val();
$.ajax({
url:"{{route('dynamicdependent.fetch')}}",
method:"POST",
data:{select:select, value:value, _token:_token,
dependent=dependent},
success:function(result){
$('#+dependent').html(result);
}
})
}
});
});
</script>
#endsection
please help. and i am also new in Laravel
There are two mistakes:-
In ajax request data you are setting dependent=dependent that should be dependent: dependent.
In Success response, you are setting this $('#+dependent').html(result); but that is not correct. It should be this $('#'+dependent).html(result);
Below is the full jQuery code:
<script>
$(document).ready(function(){
$('.dynamic').change(function(){
if($(this).val()!=''){
var select = $(this).attr("id");
var value = $(this).val();
var dependent = $(this).data('dependent');
var __token = $('input[name=_token"]').val();
$.ajax({
url:"{{route('dynamicdependent.fetch')}}",
method:"POST",
data:{
select:select,
value:value,
_token:_token,
dependent:dependent
},
success:function(result){
$('#'+dependent).html(result);
}
});
}
});
});
</script>
Please check and let me know if that will not help. I will try to solve your problem.

Catch ONLY the invalid credentials error in a login.blade Laravel

I am using the custom login controller from Laravel. I have the validation messages in a below the input fields.
Everything works fine.
What I want now is to show a message “incorrect credentials” ONLY when user or password are incorrect and in a different div. I mean, if other validation error triggers, this message should not be visible.
The errors->has(‘email’) array catches this error but also the rest, for instance, ‘the field is required’.
Does anybody know how to write a condition that only catches this ‘invalid credentials’ error message?
Below the template.
Thanks in advance for your help!
#extends ('layouts.default')
#section('content')
#if ($errors->has('email')) {{-- I want the credential error here, but only
for credential error is triggered --}}
<div class="warning">
<div class="input-icon">
<i style="font-size:1.5em; color:Tomato; margin-right:5px;" class="fas
fa-exclamation-triangle"></i>
</div>
<p>Usuario o contraseña incorrecta</p>
</div>
#endif
<main class="login-page">
<div class="contact login">
<div class="titulos">
<p>Ingresar</p>
<p>Soy nuevo</p>
</div>
<form method="post">
#csrf
<div class="input-group input-group-icon">
<input type="email" name="email" placeholder="Correo electrónico"
value="{{ old('email') }}" autofocus/>
<div class="input-icon">
<i class="fas fa-envelope"></i>
</div>
<span class="obligatorio" > {{ $errors->first('email') }}</span>
</div>
<div class="input-group input-group-icon">
<input type="password" name="contraseña"
placeholder="Contraseña"/>
<div class="input-icon">
<i class="fas fa-lock"></i>
</div>
<span class="obligatorio" >{{ $errors->first('contraseña') }}
<div class="input-group">
<input type="submit" value="Ingresar" />
<a href="{{ route('password.request') }}">Olvidé mi
contraseña</a>
</div>
<div>
<label>
<input type="checkbox" name="recordar" id="cbox1"
value="recordar" {{ old('recordar') ? 'checked' : '' }}>
<span>Recordar mi usuario</span>
</label>
</div>
</form>
</div>
</main>
#endsection
In an old beginner Project of mine I did it this way:
<div class="form-group{{ $errors->has('text') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">#lang('views/auth/login.username')</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name">
#if ($errors->has('text'))
<span class="help-block">
<strong>{{ $errors->first('text') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">#lang('views/auth/login.password')</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password">
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
And inside the Controller I just catched the Exceptions:
public function authenticate(Request $request)
{
try {
$this->ldapHelper->checkCredentials($request->name, $request->password);
$ldapUserData = $this->ldapHelper->getFormattedUserData(request('name'));
$this->sessionService->login($ldapUserData);
return redirect()->route('form.formular');
} catch (\Exception $e) {
return back()->withInput()->withErrors([
'message' => $e->getMessage(),
]);
}
}
Maybe it helps!

Missing required parameters for Route with custom password reset

I'm trying to add new type of users "Client" into existing project.
It already had "Admin" user, which does not have email password reset function.
I duplicated and modified native Laravel out of the box Auth controllers, blade forms and model and now I can login and logout as Client (guard:client).
My problem is in password reset function.
"Forgot Your Password?" button redirects to the right url (http://127.0.0.1:8000/client/password/reset).
"Send Password Reset Link" button generates email with link (http://127.0.0.1:8000/client/password/reset/a7558b0f294af7cdaeafd73617f664e1d76ed27d567d648e8b468eb9edcc9c2d)
But when push that link I get following error:
Missing required parameters for [Route: client.password.reset] [URI:
client/password/reset/{token}]. (View:
C:\wamp64\www\testkz\resources\views\index\client\reset.blade.php)
Where reset.blade.php is a copy of resources\views\auth\passwords\reset.blade.php
My routes
Route::post('/password/email','Client\ClientForgotPasswordController#sendResetLinkEmail')->name('client.password.email');
Route::get('/password/reset','Client\ClientForgotPasswordController#showLinkRequestForm')->name('client.password.request');
Route::post('/password/reset','Client\ClientResetPasswordController#reset');
Route::get('/password/reset/{token}','Client\ClientResetPasswordController#showResetForm')->name('client.password.reset');
ClientResetPasswordController
<?php
namespace App\Http\Controllers\Client;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
use Password;
use Auth;
class ClientResetPasswordController extends Controller
{
use ResetsPasswords;
protected $redirectTo = '/client';
public function __construct()
{
$this->middleware('guest:client');
}
protected function guard()
{
return Auth::guard('client');
}
protected function broker()
{
return Password::broker('clients');
}
public function showResetForm(Request $request, $token = null)
{
return view('index.client.reset')->with(
['token' => $token, 'email' => $request->email]
);
}
}
blade
#extends('index.layout.layout')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Reset Client Password</div>
<div class="panel-body">
#if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
#endif
<form class="form-horizontal" role="form" method="POST" action="{{ route('client.password.reset') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</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{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
#if ($errors->has('password_confirmation'))
<span class="help-block">
<strong>{{ $errors->first('password_confirmation') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Reset Password
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
Make sure form method id POST
<form class="form-horizontal" method="POST" action="{{ route('password.request') }}">
{{ csrf_field() }}
<input type="hidden" name="token" value="{{ $token }}">
</form>
I upgraded my project from Laravel 5.3 to 5.5, but used old version of reset.blade.php

how login/register from any page in laravel

I'm using Laravel 5.5 and I want to login/register from any page in my application and not to be require to load domain.com/login or domain.com/register for that.
PS: I'm using default authentication php artisan make:auth
Just copy the form content of login/Register page and paste it in your laravel page.
<form class="form-horizontal" role="form" method="POST" action="{{ url('/login') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</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>

Resources