I make authentication system using the following command:
php artisan make:auth
It works fine. But when I try to customize the design and other stuff everything seems messy to me.i.e: When I try with wrong credential it then I can't show the message like: 'Invalid Username/password'. I inspect the all controller inside Auth folder but no detail code is there. My requirement is so simple: I just want to pass error message from controller to view and show it with my custom designed HTML template. Here is my login form:
@extends('layouts.login')
@section('content')
<div class="content">
<!-- BEGIN LOGIN FORM -->
<form class="login-form" method="POST" action="">
@csrf
<h3 class="form-title">Login to your account</h3>
CUSTOM_ERROR_MESSAGE_IF_LOGIN_FAILED
<div class="alert alert-danger display-hide">
<button class="close" data-close="alert"></button>
<span>
Enter any username and password. </span>
</div>
<div class="form-group">
<!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
<label class="control-label visible-ie8 visible-ie9">Username</label>
<div class="input-icon">
<i class="fa fa-user"></i>
<!-- <input class="form-control placeholder-no-fix" type="text" autocomplete="off" placeholder="Username" name="username"/> -->
<input id="email" type="email" class="form-control placeholder-no-fix" name="email" value="" required autocomplete="email" autofocus>
</div>
</div>
<div class="form-group">
<label class="control-label visible-ie8 visible-ie9">Password</label>
<div class="input-icon">
<i class="fa fa-lock"></i>
<!-- <input class="form-control placeholder-no-fix" type="password" autocomplete="off" placeholder="Password" name="password"/> -->
<input id="password" type="password" class="form-control placeholder-no-fix" name="password" required autocomplete="current-password">
</div>
</div>
<div class="form-actions">
<label class="checkbox">
<!-- <input type="checkbox" name="remember" value="1"/> -->
<input class="form-check-input" type="checkbox" name="remember" id="remember" >
Remember me </label>
<button type="submit" class="btn blue pull-right">
Login <i class="m-icon-swapright m-icon-white"></i>
</button>
</div>
<div class="forget-password">
<h4>Forgot your password ?</h4>
<p>
no worries, click <a href="" >
here </a>
to reset your password.
</p>
</div>
<div class="create-account">
<p>
Don't have an account yet ? <a href="javascript:;" id="register-btn">
Create an account </a>
</p>
</div>
</form>
<!-- END LOGIN FORM -->
</div>
@endsection
How can I show CUSTOM_ERROR_MESSAGE_IF_LOGIN_FAILED?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire