Refactors login view and logout view