show custom error/info message on login page

Permalink
hello every one,

I have a requirement to show custom error/success message on login page. the message will be show based on when user password has expired.

The logic Is running inside on_user_login event. when user tries to login, first will be check his/her password expiry date. if expiry date is less than to current date then show the message.

I have tried following method but it giving exception.
$this->error->add()


If anyone knows about that, please let me know I have stopper.

Thanks, Abdul Qayyum