From public Template
<! doctype html><html lang="en">
<head>
<meta charset="UTF-8">
<title>@yield('title')</title>
<link href="/admin/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="/admin/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
<link href="/admin/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
<link href="/ admin/lib/Hui - iconfont / 1.0.8 / iconfont. CSS" rel="stylesheet" type="text/css" />
@yield('cs')
</head>
<body>
@yield('content')
<script type="text/javascript" src="/ admin/lib/jquery / 1.9.1 / jquery. Min. Js." "></script>
<script type="text/javascript" src="/ admin/lib/layer / 2.4 / layer. The js." "></script>
<script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/ admin/lib/jquery validation / 1.14.0 / jquery. Validate. Js." "></script>
<script type="text/javascript" src="/ admin/lib/jquery validation / 1.14.0 / validate - the methods. The js." "></script>
<script type="text/javascript" src="/ admin/lib/jquery validation / 1.14.0 / messages_zh js." "></script>
@yield('js')
</body>
</html>
Copy the code
validation
@if($errors->any())
<div class="Huialert Huialert-error"><i class="Hui-iconfont"></i>
@foreach($errors->all() as $v)
<li>{{$v}}</li>
@endforeach
</div>
@endif
Copy the code
Login page + Verification code display
@extends('backstage.commcon.form')
@section('title'.'Back office')
@section('content')
<input type="hidden" id="TenantId" name="TenantId" value=""/> <div class="loginWraper"> <div id="loginform" class="loginBox"> @include('backstage.commcon.validate') <form class="form form-horizontal" action="{{route('backstage.login')}}" method="post" id="form_sub"> @csrf <div class="row cl"> <label class="form-label col-xs-3"><i class="Hui-iconfont"> </ I ></label> <div class="formControls col-XS-8 "> <input ID =" name="username" type="text" placeholder=" placeholder" class="input-text size-L"> </div> </div> <div class="row cl"> <label class="form-label col-xs-3"><i class="Hui-iconfont"> </ I ></label> <div class="formControls col-XS-8 "> <input ID ="" name="password" type="password" placeholder=" password" class="input-text size-L"> </div> </div> <div class="row cl"> <div class="formControls col-xs-8 col-xs-offset-3"> <input Name ="captcha" class="input-text sie-l "type="text" placeholder=" placeholder" style="width:150px; > <img src="{{ captcha_src('flat') }}" onclick="this.src='/captcha/flat? '+Math.random()"></div> </div> <div class="row cl"> <div class="formControls col-xs-8 col-xs-offset-3"> <label For ="online"> <input type="checkbox" name="online" id="online" value=""> Keep me logged in </label> </div> </div> <div class="row cl"> <div class="formControls col-xs-8 col-xs-offset-3"> <input name="" type="submit" class="btn btn-success radius size-L" value=" Deng & have spent Record & have spent" > <input name="" type="reset" class="btn btn-default radius size-L" value=" Take & have spent Elimination & have spent" > </div> </div> </form> </div> </div> @endsectionCopy the code
Verify login and verification code
public function login(Request $request)
{
$this->validate($request,[
'username'= >'required'.'password'= >'required'.'captcha'= >'required|captcha'], ['captcha.required'= >'Captcha must be written'.'captcha.captcha'= >'Verification code error'
]);
$post=$request->except(['captcha'.'_token']);
if (auth()->attempt($post)){
return 'ok';
}else{
return redirect(route('backstage.login'))->withErrors('Wrong account or password'); }}Copy the code