Check email duplicates, when edit user.

fixes #4735
- on user edit API, check whether email duplicated or not.
- added test.