Manual:$wgPasswordExpireGrace

Details
This setting defines the length of the "grace period" for password expiry, during which a user whose password has expired can bypass the "change password" prompt shown each time they log in. After this grace period has passed, the user will be unable to skip the password change screen – they will be forced to change their password the next time they log in.

Setting this to 0 disables the grace period entirely, meaning that after a user's password expires, they will be required to change it on their next login attempt.

This setting is ignored unless   is set to true.