public function postReset(Request $request)
 {
     $page_title = 'Reset';
     $data = compact('page_title');
     $validator = Validator::make($request->all(), ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:6']);
     if ($validator->fails()) {
         return view('user.reset', $data)->with('token', $request->input('token'))->withErrors($validator->errors());
     }
     $credentials = $request->only('email', 'password', 'password_confirmation', 'token');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect($this->redirectPath())->with('status', trans($response));
         default:
             return view('user.reset', $data)->with('token', $request->input('token'))->withErrors(['email' => translang($response)]);
     }
 }
 public function postLogin(Request $request)
 {
     $page_title = 'Login';
     $data = compact('page_title');
     $all = $request->all();
     $validator = Validator::make($all, [$this->loginUsername() => 'required|exists:users', 'password' => 'required']);
     if ($validator->fails()) {
         return view('user.login', $data)->withErrors($validator->errors());
     }
     // If the class is using the ThrottlesLogins trait, we can automatically throttle
     // the login attempts for this application. We'll key this by the username and
     // the IP address of the client making these requests into this application.
     $throttles = $this->isUsingThrottlesLoginsTrait();
     if ($throttles && $this->hasTooManyLoginAttempts($request)) {
         return $this->sendLockoutResponse($request);
     }
     $credentials = $this->getCredentials($request);
     if (Auth::attempt($credentials, $request->has('remember'))) {
         return $this->handleUserWasAuthenticated($request, $throttles);
     }
     // If the login attempt was unsuccessful we will increment the number of attempts
     // to login and redirect the user back to the login form. Of course, when this
     // user surpasses their maximum number of attempts they will get locked out.
     if ($throttles) {
         $this->incrementLoginAttempts($request);
     }
     return view('user.login', $data)->withErrors([$this->loginUsername() => translang('Login failed')]);
 }