implemented login action
refactor the messages passing for properly displaying error or success messages