Chore refactor auth

Re-wrote data-auth and ctr-common and added local copies customized for modal mode (modal.html). 

Index.html is still using the old version of the files.