[英]node/passportjs how to update homepage with welcome user, after logging in and redirect
因此,登錄到主頁后,單擊登錄並重定向主頁,然后在頂部讓我現在顯示“歡迎[用戶]”。 我怎么做? 登錄后,基本上從“在此處登錄”更改為“歡迎用戶並注銷”。我想添加以下內容:
h1.text-center.login-title Welcome #{user.firstName}.
登錄到我當前的html / jade后:
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
這對Pug非常簡單。 渲染時,只需將用戶名傳遞給pug並按以下方式進行處理:
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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.