I have moved my local laravel Application to Production. On my local pc the register function work's well (using Laravel Auth). On the remote host nothing happeds when I submit the register form. No validation error or something else. What is wrong with my application?
I got an 404 while the process. Here my register routes:
Route::get('register', 'Auth\RegisterController#showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController#register');
Here the content of my register.blade.php file:
<form id="js-validation-signup" action="{{ route('register') }}" method="post">
#csrf
<div class="py-3">
<div class="form-group">
<input type="text"
class="form-control form-control-lg form-control-alt{{ $errors->has('first_name') ? ' is-invalid' : '' }}"
id="first_name" name="first_name" placeholder="{{ __('First Name') }}"
value="{{ old('first_name') }}" autocomplete="off">
#if ($errors->has('first_name'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('first_name') }}</strong>
</span>
#endif
</div>
<div class="form-group">
<input type="text"
class="form-control form-control-lg form-control-alt{{ $errors->has('name') ? ' is-invalid' : '' }}"
id="name" name="name" placeholder="{{ __('Name') }}"
value="{{ old('name') }}" autocomplete="off">
#if ($errors->has('name'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
<div class="form-group">
<input type="email"
class="form-control form-control-lg form-control-alt{{ $errors->has('email') ? ' is-invalid' : '' }}"
id="email" name="email" placeholder="{{ __('E-Mail Address') }}"
autocomplete="off" value="{{ old('email') }}">
#if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
<div class="form-group">
<input type="password"
class="form-control form-control-lg form-control-alt{{ $errors->has('password') ? ' is-invalid' : '' }}"
id="password" name="password" placeholder="{{ __('Password') }}">
#if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
<div class="form-group">
<input type="password" class="form-control form-control-lg form-control-alt"
id="password_confirmation" name="password_confirmation"
placeholder="{{ __('Confirm Password') }}">
</div>
<div class="form-group">
<div class="input-group">
<input class="form-control form-control-lg form-control-alt{{ $errors->has('application_name') ? ' is-invalid' : '' }}"
id="application_name"
name="application_name" type="text"
placeholder="{{ __('Application Name') }}" autocomplete="off"
value="{{ old('application_name') }}">
<div class="input-group-append">
<span class="input-group-text input-group-text-alt">.example.com</span>
</div>
#if ($errors->has('application_name'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('application_name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox custom-control-primary">
<input type="checkbox" class="custom-control-input" id="signup-terms"
name="signup-terms">
<label class="custom-control-label" for="signup-terms">I agree to Terms &
Conditions</label>
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-block btn-hero-lg btn-hero-primary">
<i class="fa fa-fw fa-user-plus mr-1"></i> Sign Up
</button>
<p class="mt-3 mb-0 d-lg-flex justify-content-lg-between">
<a class="btn btn-sm btn-light d-block d-lg-inline-block mb-1" href="#">
<i class="fa fa-book text-muted mr-1"></i> Read Terms
</a>
</p>
</div>
</form>
I think i had the same problem with login here.
my problem was that I used Laravel's auth login and inside Auth/LoginController has a
use AuthenticatesUsers which uses a trait that is inside vendor and Auth folder and when I wanted to use git clone to get the project on another computer and used composer install to install the used packages for the project my vendor changed to default and all the login code which was in AuthenticatesUsers trait removed and changed to default
The route() function is for named routes.
It seems that you named your get route but didn't do that with the corresponding post route. Accessing route('register') with a POST method will result in a 404 error.
Try to name the post route as well or use action('Auth\RegisterController#register')
<form id="js-validation-signup" action="{{action('Auth\RegisterController#register')}}" method="post">
Related
It used to work somoothly, then I added Sociallite and then it some point it broke the default login with email and password.
Now every time I login with username and password I get the error "419 Page Expired" and it's literally diving me crazy because I have tried everything, with no luck.
View login.blade.php:
<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>
Route web.php:
Route::post('login', [
'as' => '',
'uses' => 'Auth\LoginController#login'
]);
I searched the web and found some ppl talking about clearing cash, clearing cookies, checking cash and storage permissions, clearing SESSION_DOMAIN and I did all, but it's still the same.
Please anyone is still facing such issue in Larvel 7?
I am trying to follow this template design:Template and I seem to be having some issue regarding the card height and padding with my current login page. Here is the code:
#section('content')
<div class="container">
<div class="card row h-100">
<div class="card-body">
<form method="POST" action="{{ route('login') }}">
#csrf
<div class="row">
<div class="col">
<img class="img-fluid rounded mx-auto d-block" src="{{asset('svg/MegaDeskLogo.svg')}}" alt="logo" />
</div>
<div class="col">
<h1>{{ __('Login') }}</h1>
<input id="email" type="email" placeholder="{{ __('E-Mail Address') }}" 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
<input id="password" placeholder="{{ __('Password') }}" type="password" class="form-control {{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" required>
#if ($errors->has('password'))
<span class="invalid-feedback" role="alert">
<strong>
{{ $errors->first('password') }}
</strong>
</span>
#endif
<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>
<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>
#endsection
Currently it's looking like: . I've tried reading several articles and reading the bootstrap documentation and still not able to find the answer. If anyone can offer any suggestions I would really appreciate it.
Make sure you're adding all the CSS and Javascript libraries and code you need for your card to look like the example, they are using more than just bootstrap.
Their CSS block:
Their Script block looks like:
I am using laravel 5.6 and have the follwing in blade file:
<form method="POST" action="/review">
#csrf
{{ $errors->first('nickname') }}
<input type="hidden" name="book_id" value="{{ request()->route('id') }}">
<div class="form-group">
<label for="nickname">nickname:</label>
<input type="text" name="nickname" class="form-control {{ $errors->has('nickname') ? 'is-ivalid' : ''}}" id="nickname">
#if($errors->has('nickname'))
<div class="invalid-feedback" role="alert">
<strong>{{ $errors->first('nickname') }}</strong>
</div>
#endif
</div>
<div class="form-group">
<label for="review">comment:</label>
<textarea name="review" class="form-control"></textarea>
#if($errors->has('review'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('review') }}</strong>
</span>
#endif
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
as you see in the third line I added {{$errors->first('nickname')}} just to make sure it has output and it does but just not showing the output under the input field.
how to solve this? why it happened?
You have a typo in {{ $errors->has('nickname') ? 'is-ivalid' : ''}} should be is-invalid.
Hi there I have this fields:
<form role="form" class="form margin-bottom-0" action="{{ url('/test') }}" method="post" enctype="multipart/form-data">
{{ csrf_field() }}
<div class="box box-widget widget-use padding-40 padding-top-0 box-shadow-none">
<div class="row">
<div class="col-md-6">
<div class="form-group floating-label {{ $errors->has('name') ? ' has-error' : '' }}">
<input class="form-control" name="name" id="regular2" type="text" value="#if($account){{$account['name']}} #endif" >
<label for="regular2" >#lang('payment.full_name')</label>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="col-md-6">
<div class="form-group floating-label {{ $errors->has('address') ? ' has-error' : '' }}">
<input class="form-control" name="address" id="regular2" type="text" value="#if($account){{$account['address']}}#endif" >
<label for="regular2">#lang('payment.address')</label>
#if ($errors->has('address'))
<span class="help-block">
<strong>{{ $errors->first('address') }}</strong>
</span>
#endif
</div>
</div>
</div>
</div>
<button type="submit" class="btn save-lang savecard">#lang('buttons.save_changes')</button>
</form>
and when I submit it shows me the validation just fine
but when I fill one field and I submit the field that I put text on it empties, how can I make the text to stay..?
Try this on every inputs you have:
<input class="form-control" name="name" id="regular2" type="text" value="{{ old('name') }}" >
Just use old().
You can use the old method in your template referring the documentation
If you use $this->validate(/*your rules*/) in your controller, it will send the errors and the old input.
Then your can use for exemple :
<input class="form-control" name="name" id="regular2" type="text" value="{{ old('name') }}" > To make the text stay.
Hopes it helps you.
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>