added login required function and decorator