Implement routes authentication, fix email template, add logout path, and refactor controllers

...d refactor controllers