added logic to hide password fields when not required