为了账号安全,请及时绑定邮箱和手机立即绑定

laravel自带登录注册页面中的前端输入格式校验定义在哪里?

laravel自带登录注册页面中的前端输入格式校验定义在哪里?

PHP
慕码人8056858 2019-03-05 04:42:19
问题描述 使用laravel自带 php artisan make:auth 命令后生成的 位于resources/views/auth内的 login.blade.php ,register.blade.php 。自带的登录注册认证是邮箱和密码,网页内的邮箱地址输入框带了一个必须要有“@”符号的校验。现由于改用手机号登录,在原有的代码上将邮箱修改为相应手机号,但依旧有“@”校验,如下图: 现在翻遍能找到的地方都找不到这个框来自何处 问题出现的环境背景及自己尝试过哪些方法 各种 chrome 检查找 相关代码 // 请把代码文本粘贴到下方(请勿用图片代替代码)layoutsapp.blade.php <!DOCTYPE html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- CSRF Token --> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <!-- Scripts --> <script src="{{ asset('js/app.js') }}" defer></script> <!-- Fonts --> <link rel="dns-prefetch" href="//fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css"> <!-- Styles --> <link href="{{ asset('css/app.css') }}" rel="stylesheet"> </head> <body> <div id="app"> <nav class="navbar navbar-expand-md navbar-light navbar-laravel"> <div class="container"> <a class="navbar-brand" href="{{ url('/') }}"> {{ config('app.name', 'Laravel') }} </a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarSupportedContent"> <!-- Left Side Of Navbar --> <ul class="navbar-nav mr-auto"> </ul> <!-- Right Side Of Navbar --> <ul class="navbar-nav ml-auto"> <!-- Authentication Links --> @guest <li class="nav-item"> <a class="nav-link" href="{{ route('login') }}">{{ __('Login') }}</a> </li> @if (Route::has('register')) <li class="nav-item"> <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a> </li> @endif @else <li class="nav-item dropdown"> <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre> {{ Auth::user()->name }} <span class="caret"></span> </a> <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown"> <a class="dropdown-item" href="{{ route('logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();"> {{ __('Logout') }} </a> <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;"> @csrf </form> </div> </li> @endguest </ul> </div> </div> </nav> <main class="py-4"> @yield('content') </main> </div> </body> </html> register.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">{{ __('Register') }}</div> <div class="card-body"> <form method="POST" action="{{ route('register') }}"> @csrf <div class="form-group row"> <label for="phone" class="col-md-4 col-form-label text-md-right">{{ __('手机号') }}</label> <div class="col-md-6"> <input id="phone" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="phone_numbers" value="{{ old('phone_numbers') }}" required> @if ($errors->has('phone')) <span class="invalid-feedback" role="alert"> <strong>{{ $errors->first('phone') }}</strong> </span> @endif </div> </div> <div class="form-group row"> <label for="code" class="col-md-4 col-form-label text-md-right">{{ __('短信验证码') }}</label> <div class="col-md-6"> <input id="code" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="sms_code" value="{{ old('code') }}" required> @if ($errors->has('code')) <span class="invalid-feedback" role="alert"> <strong>{{ $errors->first('code') }}</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"> {{ __('提交') }} </button> </div> </div> </form> </div> </div> </div> </div> </div> @endsection 你期待的结果是什么?实际看到的错误信息又是什么? 这个框到底在哪 怎么把它去掉??
查看完整描述

2 回答

?
萧十郎

TA贡献1815条经验 获得超13个赞

<input type=“text”/>

查看完整回答
反对 回复 2019-03-18
?
紫衣仙女

TA贡献1839条经验 获得超15个赞

<input id="phone" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}" name="phone_numbers" value="{{ old('phone_numbers') }}" required>

这个的type="email" 改成type=“text”,那个框是h5自带的检查验证。把里面的required去掉也能让框去掉

查看完整回答
反对 回复 2019-03-18
  • 2 回答
  • 0 关注
  • 558 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信