SHARE
TWEET

Untitled

a guest Feb 17th, 2017 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Spent some couple minutes trying to hack this. So I want to share the fix! */
  2.  
  3. //Open /vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php
  4. //Copy out the functions "credentials" and "username" respectively to your "LoginController.php"
  5. //edit the functions in the LoginController.php as thus:
  6.  
  7. protected function credentials(Request $request)
  8.     {
  9.         $field = filter_var($request->input($this->username()), FILTER_VALIDATE_EMAIL) ? 'email' : 'username';
  10.         $request->merge([$field => $request->input($this->username())]);
  11.         return $request->only($field, 'password');
  12.     }
  13.    
  14.    
  15.     public function username()
  16.     {
  17.         return 'login'; //change this to the <input name=""> of your username/email text input in login.blade.php
  18.     }
RAW Paste Data
Top