mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 12:41:45 +02:00
fix: secure protected routes
This commit is contained in:
@@ -170,8 +170,8 @@ function EditorSwitch() {
|
||||
function Root() {
|
||||
const path = getCurrentPath();
|
||||
switch (path) {
|
||||
case "/account/confirmed":
|
||||
return rootroutes["/account/confirmed"]();
|
||||
case "/account/verified":
|
||||
return rootroutes["/account/verified"]();
|
||||
case "/account/recovery":
|
||||
return rootroutes["/account/recovery"]();
|
||||
default:
|
||||
|
||||
@@ -4,7 +4,7 @@ import EmailConfirmed from "../views/emailconfirmed";
|
||||
|
||||
const rootroutes = {
|
||||
"/account/recovery": () => <AccountRecovery />,
|
||||
"/account/confirmed": () => <EmailConfirmed />,
|
||||
"/account/verified": () => <EmailConfirmed />,
|
||||
};
|
||||
|
||||
export default rootroutes;
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { Button, Flex, Text } from "rebass";
|
||||
import ThemeProvider from "../components/theme-provider";
|
||||
import * as Icon from "../components/icons";
|
||||
import { useQueryParams } from "../navigation";
|
||||
|
||||
function EmailConfirmed() {
|
||||
const [{ userId }] = useQueryParams();
|
||||
|
||||
useEffect(() => {
|
||||
if (!userId) window.location.href = "/";
|
||||
}, [userId]);
|
||||
|
||||
function EmailConfirmed(props) {
|
||||
return (
|
||||
<ThemeProvider>
|
||||
<Flex
|
||||
@@ -31,7 +38,7 @@ function EmailConfirmed(props) {
|
||||
variant="secondary"
|
||||
mt={1}
|
||||
onClick={() => {
|
||||
window.location.href = "https://notesnook.com/";
|
||||
window.location.href = "/";
|
||||
}}
|
||||
>
|
||||
Return to Notesnook
|
||||
|
||||
Reference in New Issue
Block a user