diff --git a/src/PermissionsHook.php b/src/PermissionsHook.php index 05e26ef..0d3b189 100644 --- a/src/PermissionsHook.php +++ b/src/PermissionsHook.php @@ -219,15 +219,25 @@ class PermissionsHook implements // Adjust user groups if ($rnrsHashVerified) { - // If hash verified, and not in the confirmed group, add to confirmed group - if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { - $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); - $rnrsInConfirmedGroup = true; + // If hash verified, and not in the confirmed group, + // add to confirmed group + if (!$rnrsInConfirmedGroup) { + if ($rnrsEnabledConfirmedGroup) { + $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = true; + } else if ($rnrsEnabledExemptGroup) { + $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = true; + } } } else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) { - if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { - $this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); - $rnrsInConfirmedGroup = false; + // If verify exempted, hash not verified, but in the confirmed group, + // remove from confirmed group + if ($rnrsInConfirmedGroup) { + if ($rnrsEnabledConfirmedGroup) { + $this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = false; + } } } @@ -291,15 +301,25 @@ class PermissionsHook implements // Adjust user groups if ($rnrsHashVerified) { - // If hash verified, and not in the confirmed group, add to confirmed group - if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { - $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); - $rnrsInConfirmedGroup = true; + // If hash verified, and not in the confirmed group, + // add to confirmed group + if (!$rnrsInConfirmedGroup) { + if ($rnrsEnabledConfirmedGroup) { + $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = true; + } else if ($rnrsEnabledExemptGroup) { + $this->addGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = true; + } } } else if ($rnrsInExemptGroup || $rnrsInOtherExemptedGroups) { - if ($rnrsEnabledConfirmedGroup && !$rnrsInConfirmedGroup) { - $this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); - $rnrsInConfirmedGroup = false; + // If verify exempted, hash not verified, but in the confirmed group, + // remove from confirmed group + if ($rnrsInConfirmedGroup) { + if ($rnrsEnabledConfirmedGroup) { + $this->removeGroup($user, $this->config->get('RNRSConfirmedGroup')); + $rnrsInConfirmedGroup = false; + } } }