Refactor user profile form and fix #1098