feat(users): add reset password flow (#772)

This commit is contained in:
Jakob Ankarhem
2021-02-05 15:23:57 +01:00
committed by GitHub
parent c0ea2bd189
commit e5966bd3fb
18 changed files with 734 additions and 29 deletions

View File

@@ -91,7 +91,7 @@ const CoreApp: Omit<NextAppComponentType, 'origGetInitialProps'> = ({
});
}, [currentLocale]);
if (router.pathname.match(/(login|setup)/)) {
if (router.pathname.match(/(login|setup|resetpassword)/)) {
component = <Component {...pageProps} />;
} else {
component = (
@@ -184,7 +184,7 @@ CoreApp.getInitialProps = async (initialProps) => {
// If there is no user, and ctx.res is set (to check if we are on the server side)
// _AND_ we are not already on the login or setup route, redirect to /login with a 307
// before anything actually renders
if (!router.pathname.match(/(login|setup)/)) {
if (!router.pathname.match(/(login|setup|resetpassword)/)) {
ctx.res.writeHead(307, {
Location: '/login',
});

View File

@@ -0,0 +1,9 @@
import React from 'react';
import type { NextPage } from 'next';
import ResetPassword from '../../../components/ResetPassword';
const ResetPasswordPage: NextPage = () => {
return <ResetPassword />;
};
export default ResetPasswordPage;

View File

@@ -0,0 +1,9 @@
import React from 'react';
import type { NextPage } from 'next';
import RequestResetLink from '../../components/ResetPassword/RequestResetLink';
const RequestResetLinkPage: NextPage = () => {
return <RequestResetLink />;
};
export default RequestResetLinkPage;