Laravel5 self-Signed login verification should be how post

Source: Internet
Author: User
Laravel5 itself with login verification, such as open localhost/home will automatically jump to localhost/auth/login if I want to post a request in the client to localhost/auth/login how should I send it? Does the body of the post need to write a lot of things, including Email,password,_token? In addition, the login succeeds or fails to return a custom string prompt succeeds or fails, and now comes with redirect. Novice seeking Guidance

Reply content:

Laravel5 itself with login verification, such as open localhost/home will automatically jump to localhost/auth/login if I want to post a request in the client to localhost/auth/login how should I send it? Does the body of the post need to write a lot of things, including Email,password,_token? In addition, the login succeeds or fails to return a custom string prompt succeeds or fails, and now comes with redirect. Novice seeking Guidance

You can redefine the Postlogin method in HomeController
Laravel5 default Postlogin is just the most basic example, if you can use, it is best, basically can only be used as a reference, formal development must have a lot of exceptions

The default Postlogin method is
Authenticatesandregistersusers in this trait
including login, registration, logout, etc.

    1. Laravel implementation of the form is _token (Csrf_token) + _method (post|put|patch|head|get|) + body

    2. Laravel all view can directly access a $errors (instance) can be determined by $error->has () that there is no error $errors->all () Extract all error content error Implementation mechanism is flash session so whether it is Return redirect or return view can be accessed to the $erorrs

    3. Suggest studying https://laracasts.com/series/laravel-5-fundamentals and you'll be transparent.

@if (count($errors) > 0)            
  
   
   
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif

You can copy this into the template and watch it.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.