import React, { useState } from 'react'; import ImageFader from '../Common/ImageFader'; import { defineMessages, useIntl } from 'react-intl'; import LanguagePicker from '../Layout/LanguagePicker'; import Button from '../Common/Button'; import { Field, Form, Formik } from 'formik'; import * as Yup from 'yup'; import axios from 'axios'; import { useRouter } from 'next/router'; import Link from 'next/link'; const messages = defineMessages({ passwordreset: 'Password Reset', resetpassword: 'Reset your password', password: 'Password', confirmpassword: 'Confirm Password', validationpasswordrequired: 'You must provide a password', validationpasswordmatch: 'Passwords must match', validationpasswordminchars: 'Password is too short; should be a minimum of 8 characters', gobacklogin: 'Return to Sign-In Page', resetpasswordsuccessmessage: 'Password reset successfully!', }); const ResetPassword: React.FC = () => { const intl = useIntl(); const router = useRouter(); const [hasSubmitted, setSubmitted] = useState(false); const guid = router.query.guid; const ResetSchema = Yup.object().shape({ password: Yup.string() .required(intl.formatMessage(messages.validationpasswordrequired)) .min(8, intl.formatMessage(messages.validationpasswordminchars)), confirmPassword: Yup.string() .required(intl.formatMessage(messages.validationpasswordmatch)) .test( 'passwords-match', intl.formatMessage(messages.validationpasswordmatch), function (value) { return this.parent.password === value; } ), }); return (
{intl.formatMessage(messages.resetpasswordsuccessmessage)}
> ) : (