showing flash messages on success and failure