There are functions for
What's the best way to tell if I'm on a page that is requesting that I login? I guess that would just be the wp-login.php page.
Paste this function in your functions.php or a plugin file:
and then you can use it like this: