Update application_controller.rb

Add ensure_logged_in method to avoid malicious attack