Refactored update password JS.