Skip to content

Commit

Permalink
[TASK] CI/CD code quality check
Browse files Browse the repository at this point in the history
  • Loading branch information
esteban committed Nov 26, 2024
1 parent 9c6a4eb commit b65333d
Showing 1 changed file with 37 additions and 44 deletions.
81 changes: 37 additions & 44 deletions Classes/XClass/Controller/PasswordRecoveryController.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of the "headless" Extension for TYPO3 CMS.
* This file is part of the 'headless' Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
Expand All @@ -11,18 +11,13 @@

namespace FriendsOfTYPO3\Headless\XClass\Controller;

use TYPO3\CMS\Extbase\Http\ForwardResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Core\Messaging\AbstractMessage;
use CIMEOS\CimUsers\Domain\Repository\UserRepository;
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
use FriendsOfTYPO3\Headless\Utility\HeadlessMode;
use TYPO3\CMS\Core\Crypto\PasswordHashing\PasswordHashFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Http\ForwardResponse;

class PasswordRecoveryController extends TYPO3\CMS\FrontendLogin\Controller\PasswordRecoveryController
{

/**
* Shows the recovery form. If $userIdentifier is set, an email will be sent, if the corresponding user exists and
* has a valid email address set.
Expand Down Expand Up @@ -92,58 +87,57 @@ public function showChangePasswordAction(string $hash = ''): \Psr\Http\Message\R
protected function buildShowForm($hash)
{
return [
"id" => "felogin-recovery",
'id' => 'felogin-recovery',
'method' => 'POST',
"action" => $this->uriBuilder
'action' => $this->uriBuilder
->reset()
->setTargetPageUid($GLOBALS['TSFE']->id)
->uriFor('changePassword'),
"api" => [
"label" => 'Forget password'
'api' => [
'label' => 'Forget password'
],
"elements" => [
'elements' => [
[
"identifier" => "newPass",
"type" => "Password",
"label" => "Nouveau mot de passe",
"name" => 'tx_felogin_login[newPass]',
"value" => '',
"defaultValue" => '',
"validators" => [
'identifier' => 'newPass',
'type' => 'Password',
'label' => 'Nouveau mot de passe',
'name' => 'tx_felogin_login[newPass]',
'value' => '',
'defaultValue' => '',
'validators' => [
[
"identifier" => "required",
"message" => "Le titre est obligatoire."
'identifier' => 'required',
'message' => 'Le titre est obligatoire.'
]
],
],
[
"identifier" => "newPassRepeat",
"type" => "Password",
"label" => "Répeter le nouveau mot de passe",
"name" => 'tx_felogin_login[newPassRepeat]',
"value" => '',
"defaultValue" => '',
"validators" => [
'identifier' => 'newPassRepeat',
'type' => 'Password',
'label' => 'Répeter le nouveau mot de passe',
'name' => 'tx_felogin_login[newPassRepeat]',
'value' => '',
'defaultValue' => '',
'validators' => [
[
"identifier" => "required",
"message" => "Le titre est obligatoire."
'identifier' => 'required',
'message' => 'Le titre est obligatoire.'
]
],
],
[
"identifier" => "hash",
"type" => "Hidden",
"label" => "Hash",
"name" => 'tx_felogin_login[hash]',
"value" => $hash,
"defaultValue" => '',
'identifier' => 'hash',
'type' => 'Hidden',
'label' => 'Hash',
'name' => 'tx_felogin_login[hash]',
'value' => $hash,
'defaultValue' => '',
],

]
];
}


public function changePasswordAction(string $newPass, string $hash): \Psr\Http\Message\ResponseInterface
{
if (!$this->isHeadlessEnabled()) {
Expand All @@ -161,11 +155,10 @@ public function changePasswordAction(string $newPass, string $hash): \Psr\Http\M
->getHashedPassword($newPass);

if (($hashedPassword = $this->notifyPasswordChange(
$newPass,
$hashedPassword,
$hash
)) instanceof ForwardResponse) {

$newPass,
$hashedPassword,
$hash
)) instanceof ForwardResponse) {
return $this->jsonResponse();
}

Expand Down

0 comments on commit b65333d

Please sign in to comment.