Add logout function for view.