Added before_action for verifying login and teacher reduce clutter and on_success for flash messages and redirect