Fixing authentication and implementing login properly