Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

project protected fix when password incorect

Maksim Mrug035734f1e9d5
diff --git a/src/pages/Project/View/ViewProject.tsx b/src/pages/Project/View/ViewProject.tsx
index 1d22477ee..5f3426700 100644
--- a/src/pages/Project/View/ViewProject.tsx
+++ b/src/pages/Project/View/ViewProject.tsx
@@ -63,7 +63,7 @@ import Robot from 'ui/icons/Robot'
import Forecast from 'modals/Forecast'
import routes from 'routes'
import {
- getProjectData, getProject, getOverallStats, getLiveVisitors, getPerfData, getProjectDataCustomEvents, getProjectCompareData,
+ getProjectData, getProject, getOverallStats, getLiveVisitors, getPerfData, getProjectDataCustomEvents, getProjectCompareData, checkPassword,
} from 'api'
import { getChartPrediction } from 'api/ai'
import {
@@ -438,8 +438,20 @@ const ViewProject = ({
}, 0), [activeTab])
const onErrorLoading = () => {
+ if (projectPassword) {
+ checkPassword(id, projectPassword).then((res) => {
+ if (res) {
+ history.push(_replace(routes.project, ':id', id))
+ return
+ }
+
+ showError(t('project.wrongPassword'))
+ history.push(_replace(routes.project_protected_password, ':id', id))
+ })
+ return
+ }
+
showError(t('project.noExist'))
- removeItem(PROJECTS_PROTECTED)
history.push(routes.dashboard)
}