optimize logic

这个提交包含在:
WaitSpring 2024-04-17 20:22:36 +08:00
父节点 92187a26ac
当前提交 bdb6cc028d
共有 1 个文件被更改,包括 34 次插入14 次删除

查看文件

@ -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;
}
}
}