2017-06-05 24 views
0

因此,登陆主页后,点击登录,重定向首页并在顶部我希望它现在显示'welcome [user] ”。我怎么做?从“登录这里的基本上改为“欢迎用户,并签署了”在登录后 我想补充一点:。node/passportjs如何在欢迎用户更新主页后,登录并重定向

extends layout 
    block content 



    body(style='background-color:black') 
    p 
    a.fade(href="#") 
    img.fade(src='http://data.whicdn.com/images/18140107/large.jpg', 
    height='150', width='200') 

    p 
    ul.centered 
     li.none 
     li Chapter 1 
     li Chapter 2 
     li Chapter 3 
     li Chapter 4 
     li Chapter 5 
     li Chapter 6 
     li Chapter 7 
     li Chapter 8 
     li Chapter 9 
     li Chapter 10 

回答

0

h1.text-center.login-title Welcome #{user.firstName}. 

我目前的HTML /玉在登录后这对帕格来说很简单。当您呈现,只需将用户名传递给哈巴狗和处理它,像这样:

if user.firstName 
    h1.text-center.login-title Welcome #{user.firstName}. 
else 
    h1.text-center.login-title Please Login 

在这里阅读更多:https://pugjs.org/language/conditionals.html

相关问题