implements the authenticate_user method which stops people from accessing the site without being logged it