Confirm email verification using post login action

Hi! I’m having issue with using post login action to confirm email verification when user login. Currently, it appears that this action is also triggered when a user try to register an account. As soon as clicking the “Continue” button on the registration page, I gets error. I would like to apply this action only when the user login.

Additionally, in cases where a user fails to login due to an unverified email, they are redirected to the base URL. Is there any way to display an error message on the login page instead of navigating to the base URL?
Furthermore, when I look into the error URL, I noticed that there is no error parameter.
The URL is something like this: http://example.com/login?state=

I would appreciate if you could help these issues. Thank you so much!