Changed the way authentication is handled

Also fixed login.html to support the new implementation