Hi Anand,
I'm not sure what kind of javascript you can put in login.fcc file to control.
However, you can make use of the existing .loginfcc @smretries. This parameter specify how many times user can try to submit the credentials.
For example, if you specify
@smretries=2
This means end user can retry two times for the credentials submit. Once it exceed, it will show message as per in login.unauth
###
Your credentials are not valid for <Target resource>
Please contact your Security Administrator or Help Desk.
###
Does it serve your objective?
Regards,
Kar Meng