You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
JavaScript
41 lines
1.2 KiB
JavaScript
4 years ago
|
import React, {useState} from 'react'
|
||
|
import Link from 'next/link'
|
||
|
import Router from 'next/router'
|
||
|
import Head from 'next/head'
|
||
|
import isEmail from 'validator/lib/isEmail'
|
||
|
|
||
|
import {FormController, Input, Button} from '~/components/form'
|
||
|
import useAccountRedirect from '~/hooks/useAccountRedirect'
|
||
|
|
||
|
export default function ResetPassword(){
|
||
|
useAccountRedirect()
|
||
|
|
||
|
const [submitted, setSubmitted] = useState(false)
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Head>
|
||
|
<title>Reset Password | Society of Socks</title>
|
||
|
</Head>
|
||
|
{submitted
|
||
|
? (
|
||
|
<FormController>
|
||
|
<h1>Reset Password</h1>
|
||
|
<p>
|
||
|
An email has been sent to the provided email address - check your
|
||
|
email for further instructions in resetting your password.
|
||
|
</p>
|
||
|
</FormController>
|
||
|
)
|
||
|
: (
|
||
|
<FormController url="/api/users/recover" afterSubmit={()=>setSubmitted(true)}>
|
||
|
<h1>Reset Password</h1>
|
||
|
<Input label="Email" type="text" name="email" validate={value=>isEmail(value)} hint="Enter a valid email address" />
|
||
|
<Button type="submit">Reset Password</Button>
|
||
|
</FormController>
|
||
|
)
|
||
|
}
|
||
|
</>
|
||
|
)
|
||
|
}
|