Adds login and upload log functionality. TODO: plosish, comments, readability...