Refactor of create_user

- use providers instead of choose_provider
- do something if session['provider'] is invalid
- add some comments
Return json data after login/logout for testing
Sorting posts order by both created_at and post id columns
Removed the invalid date ModelError

Use TypeError and ValueError instead
Refactor render_posts
Updated to the latest jsuri, to fix a AMD issue