fixes #4057 loginForm macro problem showing error messages

Fixed the issue and pushed the code for review. Please check it.