Enhance validation for password setting