Skip to content

Commit

Permalink
Merge branch '5.2' into 5
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Aug 14, 2024
2 parents f5af555 + a358abf commit 53d0992
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/RequestHandler/RegistrationHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public function createStartRegistrationResponse(
->addHeader('Content-Type', 'application/json');

if (!$allowReregistration && $existingRegisteredMethod) {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
return $response->setBody(json_encode(['errors' => [_t(
__CLASS__ . '.METHOD_ALREADY_REGISTERED',
'That method has already been registered against this Member'
Expand Down Expand Up @@ -80,6 +81,7 @@ public function completeRegistrationRequest(
HTTPRequest $request
): Result {
if (!SecurityToken::inst()->checkRequest($request)) {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
return Result::create(false, _t(
__CLASS__ . '.CSRF_FAILURE',
'Your request timed out. Please refresh and try again'
Expand All @@ -90,13 +92,15 @@ public function completeRegistrationRequest(

// If a registration process hasn't been initiated in a previous request, calling this method is invalid
if (!$storedMethodName) {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
return Result::create(false, _t(__CLASS__ . '.NO_REGISTRATION_IN_PROGRESS', 'No registration in progress'));
}

// Assert the method in progress matches the request for completion
if ($storedMethodName !== $method->getURLSegment()) {
return Result::create(
false,
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
_t(__CLASS__ . '.METHOD_MISMATCH', 'Method does not match registration in progress')
);
}
Expand Down
3 changes: 3 additions & 0 deletions src/RequestHandler/VerificationHandlerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ protected function createStartVerificationResponse(
if (!$registeredMethod) {
// We can display a specific message if there was no method specified
if (!$requestedMethod) {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
$message = _t(
__CLASS__ . '.METHOD_NOT_PROVIDED',
'No method was provided to login with and the Member has no default'
);
} else {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
$message = _t(__CLASS__ . '.METHOD_NOT_REGISTERED', 'Member does not have this method registered');
}

Expand Down Expand Up @@ -90,6 +92,7 @@ protected function createStartVerificationResponse(
protected function completeVerificationRequest(StoreInterface $store, HTTPRequest $request): Result
{
if (!SecurityToken::inst()->checkRequest($request)) {
/** @phpstan-ignore translation.key (we can't change this to __TRAIT__ until the next major release) */
return Result::create(false, _t(
__CLASS__ . '.CSRF_FAILURE',
'Your request timed out. Please refresh and try again'
Expand Down

0 comments on commit 53d0992

Please sign in to comment.