Skip to content

Commit

Permalink
Merge pull request #27927 from colemanw/jwtCheck
Browse files Browse the repository at this point in the history
Afform - Remove redundant status checks
  • Loading branch information
totten authored Oct 25, 2023
2 parents 9315a7c + f9efdd5 commit 7a688a9
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions ext/afform/core/Civi/Afform/StatusChecks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,8 @@ class StatusChecks {
public static function hook_civicrm_check($e) {
$hasAuthx = \CRM_Extension_System::singleton()->getMapper()->isActiveModule('authx');
$tokenFormCount = count(Tokens::getTokenForms());
if (!$hasAuthx) {
if ($tokenFormCount) {
$e->messages[] = new \CRM_Utils_Check_Message(
'afform_token_authx',
E::ts('Email token support has been configured for %2 form(s), which requires extended authentication services. Please enable "AuthX" in <a href="%1">Manage Extensions</a>.', [
1 => \CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'),
2 => $tokenFormCount,
]),
E::ts('AuthX Required'),
\Psr\Log\LogLevel::ERROR,
'fa-chain-broken'
);
}
else {
$e->messages[] = new \CRM_Utils_Check_Message(
'afform_token_authx',
E::ts('To generate authenticated email links for custom forms, enable extended authentication services (AuthX) in <a href="%1">Manage Extensions</a>.', [
1 => \CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1'),
]),
E::ts('AuthX Suggested'),
\Psr\Log\LogLevel::INFO,
'fa-lightbulb-o'
);
}
}

if ($hasAuthx && $tokenFormCount > 0 && !in_array('jwt', \Civi::settings()->get('authx_auto_cred'))) {
if ($hasAuthx && $tokenFormCount && !in_array('jwt', \Civi::settings()->get('authx_auto_cred'))) {
$e->messages[] = new \CRM_Utils_Check_Message(
'afform_token_authx',
E::ts('Email token support has been configured for %1 form(s). This requires JWT authentication, <code>authx_auto_cred</code> does not include JWT. ', [
Expand Down

0 comments on commit 7a688a9

Please sign in to comment.