Reset Password Form.

@param Request $request
@param $token

@return \Symfony\Component\HttpFoundation\Response
509939
public function resettingPassword(Request $request, UserPasswordEncoderInterface $encoder, EventDispatcherInterface $dispatcher, \Swift_Mailer $mailer, TranslatorInterface $translator, $token)
    {
        // Get Doctrine
        $em = $this->getDoctrine()->getManager();

        // Find User
        $user = $em->getRepository($this->getParameter('pd_user.user_class'))->findOneBy(['confirmationToken' => $token]);
        if (null === $user) {
            throw $this->createNotFoundException(sprintf($translator->trans('security.token_notfound'), $token));
        }

        // Build Form
        $form = $this->createForm(ResettingPasswordType::class, $user);

        // Handle Form Submit
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            // Encode Password & Set Token
            $password = $encoder->encodePassword($user, $form->get('plainPassword')->getData());
            $user->setPassword($password)
                ->setConfirmationToken(null)
                ->setPasswordRequestedAt(null);

            // Save User
            $em->persist($user);
            $em->flush();

            // Dispatch Register Event
            if ($response = $dispatcher->dispatch(UserEvent::RESETTING_COMPLETE, new UserEvent($user))->getResponse()) {
                return $response;
            }

            // Send Resetting Complete
            $this->sendEmail($user, $mailer, 'Account Password Resetting', 'Password resetting completed.', 'Resetting_Completed');

            // Render Success
            return $this->render($this->getParameter('pd_user.template_path') . '/Resetting/resettingSuccess.html.twig', [
                'sendEmail' => false,
            ]);
        }

        // Render
        return $this->render($this->getParameter('pd_user.template_path') . '/Resetting/resettingPassword.html.twig', [
            'token' => $token,
            'form' => $form->createView(),
        ]);
    }
792152
protected function attemptLogin(Request $request)
    {
        $token = $this->guard()->attempt($this->credentials($request));

        if ($token) {
            $this->guard()->setToken($token);

            return true;
        }

        return false;
    }
1032324
public function resetPassword(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('user', 'update')) {
            return $this->noPermission();
        }
        // validation
        $validator = Validator::make(
            $request->all(), [
            'password' => 'required|same:confpassword',
            'id' => 'required',
            ]
        );

        // if validation fails return json response
        if ($validator->fails()) {
            return $this->response("Please check all required fields!", 400, null, false, false, true, $validator->errors());
        }

        $user = User::where('userID', $request->id)->update(
            [
            'password' => $password = Hash::make($request->password)
            ]
        );

        if ($user) {
            $result = $this->response('Password is updated');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
771567
public function showResetForm($token = null)
    {
        $email = request('email');
        $this->showPageBanner = false;

        return $this->view('titan::reset_password', compact('token', 'email'));
    }
288101
public function showResetForm(Request $request, $token = null)
    {
        pageinfo([
            'title' => __('auth.reset'),
            'robots' => 'noindex, follow',
        ]);

        return $this->makeResponse('passwords.reset', ['token' => $token, 'email' => $request->email]);
    }
235199
public function token(Request $request)
    {
        $user = $this->getUser($request);
        
        $client = $user->clients->first();
        if (null !== $client && $client instanceof Client) {

            $serverRequest = $this->createRequest(
                $client,
                $user->id,
                $request, $scope = []
            );
            $reponse = parent::issueToken($serverRequest);
            $responseArray = json_decode($reponse->content(), true);
            unset($responseArray['refresh_token']);
            return response()->json($responseArray)
                ->setStatusCode($reponse->getStatusCode());
        }
        return response(['error' => 'Please create a client first'], 401);
    }
355140
public function showResetForm(Request $request, $token = null)
    {
        $this->data['title'] = trans('back-project::base.reset_password'); // set the page title

        return view('back-project::auth.passwords.reset', $this->data)->with(
            ['token' => $token, 'email' => $request->email]
        );
    }
207459
public function clearPasswordRequestAction(Request $request)
    {
        $context = $this->loadContext($request);
        $resourceName = $this->config->getResourceName();
        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $resource */
        $resource = $context->getResource($resourceName);

        $this->isGranted('EDIT', $resource);

        if ($resource->isPasswordRequestNonExpired($this->container->getParameter('fos_user.resetting.token_ttl'))) {
            $resource
                ->setConfirmationToken(null)
                ->setPasswordRequestedAt(null)
            ;

            // TODO use ResourceManager
            $event = $this->getOperator()->update($resource);
            $event->toFlashes($this->getFlashBag());
            $this->addFlash('ekyna_user.user.alert.password_request_cleared', 'success');
        } else {
            $this->addFlash('ekyna_user.user.alert.no_password_request', 'warning');
        }

        return $this->redirect($this->generateResourcePath($resource));
    }
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);
    }
987401
protected function resetCsrfToken($token=null)
    {
        $token || $token = $this->request->getParam($this->options['csrfTokenName']);
        FormToken::instance()->reset($token);
    }
995484
public function postLogin(Request $request)
	{
		$this->validate($request, [
			'email' => 'required|email', 'password' => 'required',
		]);

		$credentials = $request->only('email', 'password');

		if ($this->auth->attempt($credentials, $request->has('remember')))
		{
			return redirect()->intended($this->redirectPath());
		}

		return redirect($this->loginPath())
					->withInput($request->only('email', 'remember'))
					->withErrors([
						'email' => $this->getFailedLoginMessage(),
					]);
	}
974309
public function updatePassword($token, $email, $password)
    {
        // Get the token being used.
        $token = $this->tokens->findByToken($token);

        // Make sure the correct email was supplied.
        if ($token->user->email !== $email) {
            return Response::failed('The email does not match this token.')
                           ->route('auth.password.reset');
        }

        // Reset the user's password and let them log in.
        $token->user->resetPassword($password);

        return Response::passed('Password updated.')
                       ->route('auth.login');
    }
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();
    }
84726
public function resetPassword(Request $request): Response
    {
        $this->denyAccessUnlessLoggedIn();

        // @todo verify hash and if not valid show error page with message

        if ($request->isMethod(Request::METHOD_POST)) {
            // @todo: update password, login customer and redirect to account and show success message
            return $this->redirectToRoute('frontend.account.home.page', []);
        }

        return $this->renderStorefront('@Storefront/page/account/password-reset/password-reset.html.twig', ['page' => []]);
    }
645112
public function sendResetLinkEmail(Request $request)
    {
        $this->validateEmail($request);

        // 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')
        );

        return $response == Password::RESET_LINK_SENT
            ? $this->sendResetLinkResponse($request, $response)
            : $this->sendResetLinkFailedResponse($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');
    }
1070902
public function resetPassword($token)
  {
    if (isset($_SESSION['reset']) &&  $_SESSION['reset']['token'] == $token) {
      if (isset($_POST['resetPassword'])) {
        if ($_POST['password'] == '') {
          $this->errors[] = 'Input new password!';
        }
        if ($_POST['password'] != $_POST['password2']) {
          $this->errors[] = 'The passwords you entered do not match!';
        }
        if (strlen($_POST['password']) < 8) {
          $this->errors[] = 'The password must contain at least 8 characters!';
        }
        if (empty($this->errors)) {
          $changeData = R::findOne('users', 'email = ?', array($_SESSION['reset']['email']));
          $changeData->password = password_hash($_POST['password'], PASSWORD_DEFAULT);

          if (R::store($changeData)) {
            $loadAuthSession = R::findAll('authorization', 'user_id = ?', array($changeData['id']));

            foreach ($loadAuthSession as $load)
            {
              R::trash('authorization', $load['id']);
            }

            mail($_POST['email'], 'Reset Password', "Your password will be restored", 'BulveyzTeam');

            unset($_SESSION['reset']);
            redirect('/login');
          } else {
            exit('Error DataChange');
          }
        } else {
          echo "<div class='alert alert-danger' role='alert'>" . array_shift($this->errors) . "</div>";
        }
      }
    } else {
      exit('404');
    }
  }