Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't allow to bypass unlock screen and access welcome screen #2928

Merged
merged 2 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/app/context/AccountContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ export function AccountProvider({ children }: { children: React.ReactNode }) {
if (!response.configured && !onWelcomePage) {
utils.openPage("welcome.html");
window.close();
} else if (response.configured && onWelcomePage) {
utils.redirectPage("options.html");
} else if (response.unlocked) {
if (response.configured && onWelcomePage) {
utils.redirectPage("options.html");
}
selectAccount(response.currentAccountId, true);
} else {
setAccount(null);
Expand Down
55 changes: 29 additions & 26 deletions src/app/router/Welcome/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next";
import { Outlet, Route, HashRouter as Router, Routes } from "react-router-dom";
import Container from "~/app/components/Container";
import Toaster from "~/app/components/Toast/Toaster";
import { AccountProvider } from "~/app/context/AccountContext";
import { SettingsProvider } from "~/app/context/SettingsContext";
import { getConnectorRoutes, renderRoutes } from "~/app/router/connectorRoutes";
import ChooseConnectorPath from "~/app/screens/connectors/ChooseConnectorPath";
Expand All @@ -17,34 +18,36 @@ const connectorRoutes = getConnectorRoutes();
function Welcome() {
return (
<SettingsProvider>
<Router>
<Toaster />
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<SetPassword />} />
<Route path="choose-path">
<Route index={true} element={<ChooseConnectorPath />}></Route>
<Route path="choose-connector">
<Route
index={true}
element={
<ChooseConnector
title={i18n.t("translation:choose_connector.title")}
description={i18n.t(
"translation:choose_connector.description"
)}
connectorRoutes={connectorRoutes}
/>
}
></Route>
{renderRoutes(connectorRoutes)}
<AccountProvider>
reneaaron marked this conversation as resolved.
Show resolved Hide resolved
<Router>
<Toaster />
<Routes>
<Route path="/" element={<Layout />}>
<Route index element={<SetPassword />} />
<Route path="choose-path">
<Route index={true} element={<ChooseConnectorPath />}></Route>
<Route path="choose-connector">
<Route
index={true}
element={
<ChooseConnector
title={i18n.t("translation:choose_connector.title")}
description={i18n.t(
"translation:choose_connector.description"
)}
connectorRoutes={connectorRoutes}
/>
}
></Route>
{renderRoutes(connectorRoutes)}
</Route>
</Route>
<Route path="test-connection" element={<TestConnection />} />
<Route path="pin-extension" element={<PinExtension />} />
</Route>
<Route path="test-connection" element={<TestConnection />} />
<Route path="pin-extension" element={<PinExtension />} />
</Route>
</Routes>
</Router>
</Routes>
</Router>
</AccountProvider>
</SettingsProvider>
);
}
Expand Down
Loading