added a login_required function decorator.

TO-DO: learn more about function decorators.