import React from 'react' import Router from 'next/router' import Layout from '../../components/MyLayout' import { NextAuth } from 'next-auth/client' export default class extends React.Component { static async getInitialProps({req, res, query}) { let props = {}; props.session = await NextAuth.init({force: true, req: req}) // If signed in already, instead of displaying message send to callback page // which should redirect them to whatever page it normally sends clients to if (props.session.user) { if (req) { res.redirect('/auth/callback') } else { Router.push('/auth/callback') } } props.email = query.email return props } render() { return (

Check your email

A sign in link has been sent to { (this.props.email) ? {this.props.email} : your inbox }.

) } }