Refine login/logout/signup functionality and build posts logic