Add action validation in server.

* Use routes for validating user actions when interacting with server.
* Also add tests for action validation.
* Closes #2356.