feat: coming soon
This commit is contained in:
@ -1,68 +0,0 @@
|
||||
import Link from 'next/link'
|
||||
|
||||
import { Input } from 'components/design/Input'
|
||||
import { Head } from 'components/Head'
|
||||
import { Header } from 'components/Header'
|
||||
import { FormState } from 'components/Authentication/FormState'
|
||||
import { Container } from 'components/design/Container'
|
||||
import { AuthenticationFormLayout } from 'components/Authentication/AuthenticationFormLayout'
|
||||
import { emailSchema } from 'components/Authentication/AuthenticationForm'
|
||||
import { useForm } from 'hooks/useForm'
|
||||
import { api } from 'utils/api'
|
||||
import { authenticationFromServerSide } from 'utils/authentication'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
const ForgotPassword: React.FC = () => {
|
||||
const {
|
||||
getErrorMessages,
|
||||
formState,
|
||||
message,
|
||||
handleChange,
|
||||
handleSubmit
|
||||
} = useForm({
|
||||
validatorSchema: emailSchema
|
||||
})
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title={`Thream | ${t('authentication:forgot-password')}`} />
|
||||
|
||||
<Header />
|
||||
<Container>
|
||||
<AuthenticationFormLayout
|
||||
onChange={handleChange}
|
||||
onSubmit={handleSubmit(async (formData) => {
|
||||
await api.post(
|
||||
`/users/resetPassword?redirectURI=${window.location.origin}/authentication/reset-password`,
|
||||
formData
|
||||
)
|
||||
return await t('authentication:success-forgot-password')
|
||||
})}
|
||||
link={
|
||||
<p>
|
||||
<Link href='/authentication/signin'>
|
||||
<a>{t('authentication:already-know-password')}</a>
|
||||
</Link>
|
||||
</p>
|
||||
}
|
||||
>
|
||||
<Input
|
||||
errors={getErrorMessages('email')}
|
||||
type='email'
|
||||
placeholder='Email'
|
||||
name='email'
|
||||
label='Email'
|
||||
/>
|
||||
</AuthenticationFormLayout>
|
||||
<FormState state={formState} message={message} />
|
||||
</Container>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: false
|
||||
})
|
||||
|
||||
export default ForgotPassword
|
@ -1,75 +0,0 @@
|
||||
import { useRouter } from 'next/router'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Input } from 'components/design/Input'
|
||||
import { Header } from 'components/Header'
|
||||
import { FormState } from 'components/Authentication/FormState'
|
||||
import { Container } from 'components/design/Container'
|
||||
import { AuthenticationFormLayout } from 'components/Authentication/AuthenticationFormLayout'
|
||||
import { passwordSchema } from 'components/Authentication/AuthenticationForm'
|
||||
import { useForm } from 'hooks/useForm'
|
||||
import { api } from 'utils/api'
|
||||
import { authenticationFromServerSide } from 'utils/authentication'
|
||||
|
||||
const ResetPassword: React.FC = () => {
|
||||
const router = useRouter()
|
||||
const { t } = useTranslation()
|
||||
|
||||
const {
|
||||
getErrorMessages,
|
||||
formState,
|
||||
message,
|
||||
handleChange,
|
||||
handleSubmit
|
||||
} = useForm({
|
||||
validatorSchema: passwordSchema
|
||||
})
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title={`Thream | ${t('authentication:reset-password')}`} />
|
||||
|
||||
<Header />
|
||||
<Container>
|
||||
<AuthenticationFormLayout
|
||||
onChange={handleChange}
|
||||
onSubmit={handleSubmit(async (formData) => {
|
||||
await api.put('/users/resetPassword', {
|
||||
...formData,
|
||||
tempToken: router.query.tempToken
|
||||
})
|
||||
await router.push('/authentication/signin')
|
||||
return null
|
||||
})}
|
||||
>
|
||||
<Input
|
||||
errors={getErrorMessages('password')}
|
||||
type='password'
|
||||
placeholder='Password'
|
||||
name='password'
|
||||
label='Password'
|
||||
/>
|
||||
</AuthenticationFormLayout>
|
||||
<FormState state={formState} message={message} />
|
||||
</Container>
|
||||
|
||||
<style jsx>
|
||||
{`
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
.signin-link {
|
||||
font-size: 16px;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: false
|
||||
})
|
||||
|
||||
export default ResetPassword
|
@ -1,38 +0,0 @@
|
||||
import { useRouter } from 'next/router'
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Authentication as AuthenticationComponent } from 'components/Authentication'
|
||||
import { api } from 'utils/api'
|
||||
import {
|
||||
Authentication,
|
||||
authenticationFromServerSide,
|
||||
Tokens
|
||||
} from 'utils/authentication'
|
||||
|
||||
const Signin: React.FC = () => {
|
||||
const router = useRouter()
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title={`Thream | ${t('authentication:signin')}`} />
|
||||
<AuthenticationComponent
|
||||
mode='signin'
|
||||
onSubmit={async (formData) => {
|
||||
const { data } = await api.post<Tokens>('/users/signin', formData)
|
||||
const authentication = new Authentication(data)
|
||||
authentication.signin()
|
||||
await router.push('/application')
|
||||
return null
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: false
|
||||
})
|
||||
|
||||
export default Signin
|
@ -1,34 +0,0 @@
|
||||
import useTranslation from 'next-translate/useTranslation'
|
||||
|
||||
import { Head } from 'components/Head'
|
||||
import { Authentication } from 'components/Authentication'
|
||||
import { api } from 'utils/api'
|
||||
import { useTheme } from 'contexts/Theme'
|
||||
import { authenticationFromServerSide } from 'utils/authentication'
|
||||
|
||||
const Signup: React.FC = () => {
|
||||
const { theme } = useTheme()
|
||||
const { t, lang } = useTranslation()
|
||||
|
||||
return (
|
||||
<>
|
||||
<Head title={`Thream | ${t('authentication:signup')}`} />
|
||||
<Authentication
|
||||
mode='signup'
|
||||
onSubmit={async (formData) => {
|
||||
await api.post(
|
||||
`/users/signup?redirectURI=${window.location.origin}/authentication/signin`,
|
||||
{ ...formData, language: lang, theme }
|
||||
)
|
||||
return await t('authentication:success-signup')
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = authenticationFromServerSide({
|
||||
shouldBeAuthenticated: false
|
||||
})
|
||||
|
||||
export default Signup
|
Reference in New Issue
Block a user