I've been able to replicate this behaviour on Plone 5.2.1
Plone 5.2.1 (5208)
CMF 2.4.2
Zope 4.1.3
Log in as a site administrator
log in as a site administrator and attempt to change the password for a user under: Site Setup > Users and Group
I get an error:
Traceback (innermost last):
Module ZServer.ZPublisher.Publish, line 151, in publish
Module ZServer.ZPublisher.Publish, line 393, in commit
Module transaction._manager, line 252, in commit
Module transaction._manager, line 131, in commit
Module transaction._transaction, line 311, in commit
Module transaction._transaction, line 302, in commit
Module transaction._transaction, line 447, in _commitResources
Module transaction._transaction, line 424, in _commitResources
Module zope.sendmail.delivery, line 80, in tpc_vote
Module zope.sendmail.mailer, line 62, in vote
Module smtplib, line 256, in __init__
Module smtplib, line 318, in connect
Module smtplib, line 366, in getreply
SMTPServerDisconnected: Connection unexpectedly closed: [Errno 104] Connection reset by peer
At this point I am logged in as an site administrator:
The notify(CredentialsUpdated(self.getUserById(principal_id), password)) at the end triggers a _setupSession() which calls the _setCookie() which at the end set the new cookie, but with the userid from the selected user, not the current user.
The good thing is: it is not possible to reset the password of a user with Manager role when one is a Site Administrator only. So one can not switch to a user with more permissions.
For the record, this was reported to the Plone Security Team before this was posted here. We decided it was definitely a bug that should be fixed, but it is not a security issue: you cannot get extra privileges because of this.