finish login register function

1. add param when db callback
2. add error code
3. add register logic and test code