userportal,webadmin: Frontend refactor

- Minor refactor to allow unit testing.
- Added unit tests for all major public methods.

Change-Id: I3dae5a455ad16660b97cddafba53b53d3b4196f1
Signed-off-by: Alexander Wels <awels@redhat.com>