Skip to content

Commit 172e79c

Browse files
fix(page): add character encoding and page titles (#1380)
* added character encoding fix * changed multi-line to inline and added title param to send fn in src/server/pages/index.js * modified the return object of renderPage in src/server/pages/index.js
1 parent 46d5c76 commit 172e79c

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

src/server/pages/index.js

+26-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,34 @@ export default function renderPage (req, res) {
99
const { baseUrl, basePath, callbackUrl, csrfToken, providers, theme } = req.options
1010

1111
res.setHeader('Content-Type', 'text/html')
12-
function send (html) {
13-
res.send(`<!DOCTYPE html><head><style type="text/css">${css()}</style><meta name="viewport" content="width=device-width, initial-scale=1"></head><body class="__next-auth-theme-${theme}"><div class="page">${html}</div></body></html>`)
12+
function send ({ html, title }) {
13+
res.send(`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>${css()}</style><title>${title}</title></head><body class="__next-auth-theme-${theme}"><div class="page">${html}</div></body></html>`)
1414
}
1515

1616
return {
17-
signin (props) { send(signin({ csrfToken, providers, callbackUrl, ...req.query, ...props })) },
18-
signout (props) { send(signout({ csrfToken, baseUrl, basePath, ...props })) },
19-
verifyRequest (props) { send(verifyRequest({ baseUrl, ...props })) },
20-
error (props) { send(error({ basePath, baseUrl, res, ...props })) }
17+
signin (props) {
18+
send({
19+
html: signin({ csrfToken, providers, callbackUrl, ...req.query, ...props }),
20+
title: 'Sign In'
21+
})
22+
},
23+
signout (props) {
24+
send({
25+
html: signout({ csrfToken, baseUrl, basePath, ...props }),
26+
title: 'Sign Out'
27+
})
28+
},
29+
verifyRequest (props) {
30+
send({
31+
html: verifyRequest({ baseUrl, ...props }),
32+
title: 'Verify Request'
33+
})
34+
},
35+
error (props) {
36+
send({
37+
html: error({ basePath, baseUrl, res, ...props }),
38+
title: 'Error'
39+
})
40+
}
2141
}
2242
}

0 commit comments

Comments
 (0)