fixes #5242 - Update user upon every logon

Attributes and group memebership are being updated upon every logon.
Adds some refactorings and tests