refactoring user model for coditional password validation