added logout logic to redirect user back to their current page