ResetPassword.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\User\Controller\Adminhtml\Auth;
  8. class ResetPassword extends \Magento\User\Controller\Adminhtml\Auth
  9. {
  10. /**
  11. * Display reset forgotten password form
  12. *
  13. * User is redirected on this action when he clicks on the corresponding link in password reset confirmation email
  14. *
  15. * @return void
  16. */
  17. public function execute()
  18. {
  19. $passwordResetToken = (string)$this->getRequest()->getQuery('token');
  20. $userId = (int)$this->getRequest()->getQuery('id');
  21. try {
  22. $this->_validateResetPasswordLinkToken($userId, $passwordResetToken);
  23. $this->_view->loadLayout();
  24. $content = $this->_view->getLayout()->getBlock('content');
  25. if ($content) {
  26. $content->setData('user_id', $userId)->setData('reset_password_link_token', $passwordResetToken);
  27. }
  28. $this->_view->renderLayout();
  29. } catch (\Exception $exception) {
  30. $this->messageManager->addError(__('Your password reset link has expired.'));
  31. $this->_redirect('adminhtml/auth/forgotpassword', ['_nosecret' => true]);
  32. return;
  33. }
  34. }
  35. }