Ejemplo n.º 1
0
 /**
  * @param Request $request
  * @return RedirectResponse
  */
 public function handle(Request $request)
 {
     $input = $request->getParsedBody();
     $token = PasswordToken::findOrFail(array_get($input, 'token'));
     $password = array_get($input, 'password');
     $confirmation = array_get($input, 'password_confirmation');
     if (!$password || $password !== $confirmation) {
         return new RedirectResponse($this->url->toRoute('resetPassword', ['token' => $token->id]));
     }
     $token->user->changePassword($password);
     $token->user->save();
     $token->delete();
     return new RedirectResponse($this->url->toBase());
 }
Ejemplo n.º 2
0
 /**
  * @param Request $request
  * @return RedirectResponse
  */
 public function handle(Request $request)
 {
     $input = $request->getParsedBody();
     $token = PasswordToken::findOrFail(array_get($input, 'passwordToken'));
     $password = array_get($input, 'password');
     $confirmation = array_get($input, 'password_confirmation');
     $this->validator->assertValid(compact('password'));
     if (!$password || $password !== $confirmation) {
         return new RedirectResponse($this->url->toRoute('resetPassword', ['token' => $token->id]));
     }
     $token->user->changePassword($password);
     $token->user->save();
     $token->delete();
     $session = $request->getAttribute('session');
     $this->authenticator->logIn($session, $token->user->id);
     return new RedirectResponse($this->url->toBase());
 }
 /**
  * @param ConfigureClientView $event
  */
 public function getClientView(ConfigureClientView $event)
 {
     if ($event->isForum()) {
         $this->clientView = $event->view;
         if ($this->settings->get('avatar4eg.share-social.open_graph') && (bool) $this->settings->get('avatar4eg.share-social.open_graph') === true) {
             $this->openGraph = true;
         }
         if ($this->settings->get('avatar4eg.share-social.twitter_card') && (bool) $this->settings->get('avatar4eg.share-social.twitter_card') === true) {
             $this->twitterCard = true;
         }
         if ($this->openGraph || $this->twitterCard) {
             $data = [];
             $data['url'] = $this->urlGenerator->toBase();
             $data['title'] = $this->plainText($this->settings->get('welcome_title'), 80);
             $data['description'] = $this->plainText($this->settings->get('forum_description'), 150);
             $this->addOpenGraph(['type' => 'website', 'site_name' => $this->settings->get('forum_title')]);
             $this->addOpenGraph($data);
             $this->addTwitterCard(['card' => 'summary']);
             $this->addTwitterCard($data);
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * @param Request $request
  * @return RedirectResponse
  */
 public function handle(Request $request)
 {
     $input = $request->getParsedBody();
     $token = PasswordToken::findOrFail(array_get($input, 'passwordToken'));
     $password = array_get($input, 'password');
     try {
         // todo: probably shouldn't use the user validator for this,
         // passwords should be validated separately
         $this->validator->assertValid(compact('password'));
         $validator = $this->validatorFactory->make($input, ['password' => 'required|confirmed']);
         if ($validator->fails()) {
             throw new ValidationException($validator);
         }
     } catch (ValidationException $e) {
         $request->getAttribute('session')->set('error', $e->errors()->first());
         return new RedirectResponse($this->url->toRoute('resetPassword', ['token' => $token->id]));
     }
     $token->user->changePassword($password);
     $token->user->save();
     $token->delete();
     $session = $request->getAttribute('session');
     $this->authenticator->logIn($session, $token->user->id);
     return new RedirectResponse($this->url->toBase());
 }