Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT Ignore lint failure we can't fix yet #558

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
MNT Ignore lint failure we can't fix yet
GuySartorelli committed Aug 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit bc6a89ce4289b49d42550771e0527f5b187d1f36
4 changes: 4 additions & 0 deletions src/RequestHandler/RegistrationHandlerTrait.php
Original file line number Diff line number Diff line change
@@ -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'
@@ -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'
@@ -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')
);
}
3 changes: 3 additions & 0 deletions src/RequestHandler/VerificationHandlerTrait.php
Original file line number Diff line number Diff line change
@@ -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');
}

@@ -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'