feat: disable scripts on password reset page (#9693)
This commit is contained in:
@@ -37,7 +37,7 @@ class DashboardController < ActionController::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_dashboard_scripts
|
def set_dashboard_scripts
|
||||||
@dashboard_scripts = GlobalConfig.get_value('DASHBOARD_SCRIPTS')
|
@dashboard_scripts = sensitive_path? ? nil : GlobalConfig.get_value('DASHBOARD_SCRIPTS')
|
||||||
end
|
end
|
||||||
|
|
||||||
def ensure_installation_onboarding
|
def ensure_installation_onboarding
|
||||||
@@ -75,4 +75,14 @@ class DashboardController < ActionController::Base
|
|||||||
'application'
|
'application'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def sensitive_path?
|
||||||
|
# dont load dashboard scripts on sensitive paths like password reset
|
||||||
|
sensitive_paths = [edit_user_password_path].freeze
|
||||||
|
|
||||||
|
# remove app prefix
|
||||||
|
current_path = request.path.gsub(%r{^/app}, '')
|
||||||
|
|
||||||
|
sensitive_paths.include?(current_path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,12 +6,16 @@ import { validateRouteAccess } from '../helpers/RouteHelper';
|
|||||||
|
|
||||||
export const router = new VueRouter({ mode: 'history', routes });
|
export const router = new VueRouter({ mode: 'history', routes });
|
||||||
|
|
||||||
|
const sensitiveRouteNames = ['auth_password_edit'];
|
||||||
|
|
||||||
export const initalizeRouter = () => {
|
export const initalizeRouter = () => {
|
||||||
router.beforeEach((to, _, next) => {
|
router.beforeEach((to, _, next) => {
|
||||||
AnalyticsHelper.page(to.name || '', {
|
if (!sensitiveRouteNames.includes(to.name)) {
|
||||||
path: to.path,
|
AnalyticsHelper.page(to.name || '', {
|
||||||
name: to.name,
|
path: to.path,
|
||||||
});
|
name: to.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return validateRouteAccess(to, next, window.chatwootConfig);
|
return validateRouteAccess(to, next, window.chatwootConfig);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user