Correcting issue with credentials update

The credential object was recreated each time a user logged in or changes his password. However, we only check the first credential object leading to ignore the password update.