Unify the views in v1 controller

Removed the duplicated views for different actions and added logging to
the unified view json.ctp. Now we can see both request and response in
debug.log
Also added "oauth" parameter in url to bypass oauth when debug mode is on.
Fix user can't login with session transfer if there is an old session
Fix warnings caused by empty courseId in group controller