Add support for updating identities on each login

It allows to automatically add new e-mail addresses when user's account is modified in LDAP. Useful especially with $config['identities_level']=1
Code style, add space after foreach, remove space inside if.