Skip to content

Commit

Permalink
Afform - Remove redundant status checks
Browse files Browse the repository at this point in the history
Now that Afform and Authx are both required extensions, status check for the presence of Authx is redundant.
  • Loading branch information
colemanw committed Oct 25, 2023
1 parent 1e9aed4 commit f9efdd5
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 f9efdd5

Please sign in to comment.