Send a reset link to the given user.

@param Request $request
@return JsonResponse
332669
public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        $response = Password::broker()->sendResetLink(
            $request->only('email')
        );

        if (Password::RESET_LINK_SENT) {
            return new JsonResponse(['status' => trans($response) ], 200);
        }

        return new JsonResponse(['email' => trans($response) ], 422);

    }
1059511
public function reset(Request $request)
    {
        $this->validate($request, $this->rules(), $this->validationErrorMessages());

        // Here we will attempt to reset the user's password. If it is successful we
        // will update the password on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $response = $this->broker()->reset(
            $this->credentials($request),
            function ($user, $password) {
                $this->resetPassword($user, $password);
            }
        );

        return response()->json(['email' => trans($response)], 200);
    }
112984
public function onLogoutSuccess(Request $request)
    {
        $jsonPolicy = new JsonResponsePolicy();

        if ($jsonPolicy->isAcceptable($request)) {
            return new JsonResponse([
                'error' => 0,
                'url' => $this->targetUrl,
            ]);
        } else {
            return $this->httpUtils->createRedirectResponse($request, $this->targetUrl);
        }
    }
457548
public function resetAction(Request $request)
    {
        $cart = $this->getCart();
        $event = new OrderEvent($cart);
        $this->get('ekyna_order.order.operator')->delete($event, true);
        if (!$event->hasErrors()) {
            $this->addFlash('ekyna_cart.message.reset');
        } else {
            $event->toFlashes($this->getFlashBag());
        }

        return $this->redirectAfterContentChange($request);
    }
845539
public function sendResetLinkEmail(Request $request)
    {
        //$this->validate($request, ['email' => 'required|email']);

        $userId = Signup::where('mobile_number', $request->all('mobile_number'))->value('user_id');
        $user = User::find($userId);
        $response = Password::INVALID_USER;
        if ( $user ) {
            $email = [ 'email' => $user->email ];
            // $email = $request->only('email');

            // We will send the password reset link to this user. Once we have attempted
            // to send the link, we will examine the response then see the message we
            // need to show to the user. Finally, we'll send out a proper response.
            $response = $this->broker()->sendResetLink(
                $email, $this->resetNotifier()
            );

            if ($response === Password::RESET_LINK_SENT) {

                //return trans($response);
            }
        }

        // If an error was returned by the password broker, we will get this message
        // translated so we can notify a user of the problem. We'll redirect back
        // to where the users came from so they can attempt this process again.
        //return back()->withErrors(
        //    ['email' => trans($response)]
        //);

        switch ($response)
        {
            case Password::RESET_LINK_SENT:
                return response()->json(['success' => 'true','message'=> "Password recovery link has been send to your email address"]);
                exit;
            case Password::INVALID_USER:
                return response()->json(['error' => 'invalid_credentials','data'=> "We can't find a user that matches these credentials"], 404);
                exit;
        }
    }
1214055
public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        // We will send the password reset link to this user. Once we have attempted
        // to send the link, we will examine the response then see the message we
        // need to show to the user. Finally, we'll send out a proper response.
        $response = $this->broker()->sendResetLink(
            $request->only('email')
        );
        if ($response === Password::RESET_LINK_SENT) {
            return back()->with('msg_success', 1);
        }

        // If an error was returned by the password broker, we will get this message
        // translated so we can notify a user of the problem. We'll redirect back
        // to where the users came from so they can attempt this process again.
        return back()->withErrors(
            ['email' => trans($response)]
        );
    }
153165
public function reset(Request $request)
    {
        $this->validate($request, [
            'token' => 'required', 'email' => 'required|email',
            'password' => 'required|confirmed|min:6',
        ]);

        // Here we will attempt to reset the user's password. If it is successful we
        // will update the password on an actual user model and persist it to the
        // database. Otherwise we will parse the error and return the response.
        $response = $this->broker()->reset(
            $this->credentials($request), function ($user, $password) {
                $this->resetPassword($user, $password);
            }
        );

        // If the password was successfully reset, we will redirect the user back to
        // the application's home authenticated view. If there is an error we can
        // redirect them back to where they came from with their error message.
        return $response == Password::PASSWORD_RESET
                    ? $this->sendResetResponse($response)
                    : $this->sendResetFailedResponse($request, $response);
    }
1297688
public function resetPassword(Request $request)
    {
        $this->validate($request, [
            'password' => 'required|confirmed',
            'token'    => 'required'
       ]);

        $record= $this->resetPasswordRepo->where('token', $request['token']);
        $email = $record->first()->email;
        $record->delete();

        $user = $this->userRepo->where('email', $email)->update(['password' => $request['password']]);
        return redirect()->route('core::home');
    }
787404
public function doReset(Request $request)
    {
        $existingReset = Password_reset::where('email', $request->email)
                                        ->where('token', $request->token)
                                        ->first();

        if ($existingReset !== null)
        {
            if ($request->password === $request->input('repeat-password'))
            {
                $user = User::where('email',$request->email)->first();
                $user->password = bcrypt($request->password);
                $user->save();

                $existingReset->delete();

                return redirect()->route('success');
            }
            else
            {
                $request->session()->flash('message', 'De ingevoerde wachtwoorden komen niet overeen.');
                return back()->withInput();
            }
        }
        else
        {
            $request->session()->flash('message', 'Het ingevoerde e-mail adres is onjuist.');
            return back()->withInput($request->except('email'));
        }
    }
1249041
public function sendReset(Request $request)
    {
        $user = User::where('email', '=', $request->email)->first();
        if($user !== null)
        {
            $existingReset = Password_reset::where('email', $request->email)->first();
            if($existingReset !== null)
            {

                $existingReset->created_at = Carbon::now()->toDateTimeString();
                $existingReset->save();

                \Mail::send(config('entrance.mail.password_reset'), ['reset' => $existingReset->token], function ($m) use ($user) {
                    $m->to($user->email, $user->name)->subject('Your Password Reset!');
                });

                $request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
                return redirect()->route('reset.password');

            }
            else
            {
                $passwordReset = new Password_reset();
                $passwordReset->email = $request->email;
                $passwordReset->token = $request->_token;
                $passwordReset->created_at = Carbon::now()->toDateTimeString();
                $passwordReset->save();

                \Mail::send(config('entrance.mail.password_reset'), ['reset' => $request->_token], function ($m) use ($user) {
                    $m->to($user->email, $user->name)->subject('Your Password Reset!');
                });

                $request->session()->flash('message', 'Er is een e-mail met een link verzonden.');
                return redirect()->route('reset.password');
            }
        }
        else
        {

            $request->session()->flash('message', 'Er bestaat geen gebruiker met het ingevoerde e-mail adres.');
            return redirect()->route('reset.password');
        }
    }
1094619
public function sendResetLinkEmail(Request $request)
    {
        $this->validate($request, ['email' => 'required|email']);

        //We will send the password reset link to this user. Once we have attempted
        //to send the link, we will examine the response then see the message we
        //need to show to the user. Finally, we'll send out a proper response.
        $response = Password::broker()->sendResetLink($request->only('email'));

        if ($response == 'passwords.sent') {
            notify()->success('Success!', 'Password email sent to client.');
        }
        else {
            notify()->error('Oops', 'Something went wrong', 'warning shake animated');
        }

        return redirect()->back();
    }
614770
public function reset(Request $request)
    {
        $this->dataRepository->reset($request->get('projects'));

        return $this->success();
    }
1088768
public function resetAction(Request $request, PasswordResetToken $token): Response
    {
        $user = $this->userRepositoryCollection->findUserByToken($token);

        if ($user === null) {
            return new RedirectResponse(
                $this->router->generate('multi_user_login')
            );
        }

        $changePasswordTransferObject = ChangePasswordDataTransferObject::forUser($user);
        $form = $this->formFactory->create(ChangePasswordType::class, $changePasswordTransferObject);

        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->resetPasswordHandler->handle($form->getData());

            $this->flashBag->add(
                'success',
                $this->translator->trans(
                    'sumocoders.multiuserbundle.flash.password_reset_success'
                )
            );

            return new RedirectResponse(
                $this->router->generate('multi_user_login')
            );
        }

        return $this->templating->renderResponse(
            'SumoCodersFrameworkMultiUserBundle:PasswordReset:reset.html.twig',
            [
                'form' => $form->createView(),
            ]
        );
    }
860479
protected function sendResetLinkResponse(Request $request, $response)
    {
        if ($request->expectsJson()) {
            return response()->json([
                'status' => trans($response)
            ]);
        }
        return back()->with('status', trans($response));
    }
878985
public function resetPassword(Request $request)
  {
    if (Get::has('token')) {
      $provider = $this->provider;
      $verified = $this->verify(Get::key('token'), $provider, $this->musk());

      if (isset($verified->id)) {
        $request->rules = $this->rules();
        $request->validate();

        $this->updatePassword($request, $verified);
        return $this->success($verified);
      }
    }

    Redirect::back()->with('error', 'Token is invalid or has expired.', 200);
  }
401667
public function toggleAction(Request $request)
    {
        $name = $request->get('name');
        try {
            $this->get('ongr_settings.settings_manager')->toggleExperiment($name);
        } catch (\Exception $e) {
            return new JsonResponse(['error' => true]);
        }

        return new JsonResponse(['error' => false]);
    }
1180879
public function forgot(Request $request)
    {
        $validator = Validator::make($request->only('email'), [
            'email' => 'required|email',
        ]);

        if ($validator->fails()) {
            return response()->json($validator->errors(), 400);
        }

        $response = Password::sendResetLink($request->only('email'), function (Message $message) {

            $message->subject($this->getEmailSubject());
        });

        if ($response == Password::INVALID_USER) {
            return response()->json('User is invalid.', 400);
        }

        return response()->json(null, 200);
    }