2017-06-05 30 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

相關問題