Skip to content

Commit 94bd6a8

Browse files
authored
[4.x] Security Hardening: Unset the activation token if the mail address changes (#45221)
* Unset the activation token, if the mail address changes * strict type compare ---------
1 parent 63415b8 commit 94bd6a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

libraries/src/User/User.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,11 @@ public function save($updateOnly = false)
740740
}
741741
}
742742

743+
// Unset the activation token, if the mail address changes - that affects both, activation and PW resets
744+
if ($this->email !== $oldUser->email && $this->id !== 0 && !empty($this->activation) && !$this->block) {
745+
$table->activation = '';
746+
}
747+
743748
// Fire the onUserBeforeSave event.
744749
PluginHelper::importPlugin('user');
745750

0 commit comments

Comments
 (0)