Optimize authentificate.js. Riderect added