b540054388
* Updated example readme * Updated with-passport example * Updated profile page for with-passport * Updated with-passport-and-next-connect * Updated with-magic * Updated with-magic readme * Updated with-iron-session * Updated next version in with-iron-session Co-authored-by: Lee Robinson <me@leerob.io>
45 lines
979 B
JavaScript
45 lines
979 B
JavaScript
import { useUser } from '../lib/hooks'
|
|
import Layout from '../components/layout'
|
|
|
|
const Home = () => {
|
|
const user = useUser()
|
|
|
|
return (
|
|
<Layout>
|
|
<h1>Passport.js Example</h1>
|
|
|
|
<p>Steps to test the example:</p>
|
|
|
|
<ol>
|
|
<li>Click Login and enter a username and password.</li>
|
|
<li>
|
|
You'll be redirected to Home. Click on Profile, notice how your
|
|
session is being used through a token stored in a cookie.
|
|
</li>
|
|
<li>
|
|
Click Logout and try to go to Profile again. You'll get redirected to
|
|
Login.
|
|
</li>
|
|
</ol>
|
|
|
|
{user && (
|
|
<>
|
|
<p>Currently logged in as:</p>
|
|
<pre>{JSON.stringify(user, null, 2)}</pre>
|
|
</>
|
|
)}
|
|
|
|
<style jsx>{`
|
|
li {
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
pre {
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
}
|
|
`}</style>
|
|
</Layout>
|
|
)
|
|
}
|
|
|
|
export default Home
|