One solution may be to set a flag on res.locals
that you use in your views. You'd initialize say, res.locals.loggedIn = false;
somewhere early on in your middleware stack if they are logged in or set it to true
if they are (e.g. a session exists with some information showing they have successfully authenticated before).
Then in your view you just do something like if (loggedIn) { /* show buttons */ }