From 62761c903c42420dfe391fc070caf7151cf456cb Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 11 Jun 2021 14:07:22 +0530 Subject: [PATCH] fix login and redirect links for forms without anonymous answers --- www/form/inner.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/www/form/inner.js b/www/form/inner.js index 95fe5064b..26d591320 100644 --- a/www/form/inner.js +++ b/www/form/inner.js @@ -2512,6 +2512,16 @@ define([ } }; + var showAnonBlockedAlert = function () { + var content = UI.setHTML(h('span.cp-anon-blocked-msg'), Messages.form_anonymous_blocked); + $(content).find('a').click(function (ev) { + ev.preventDefault(); + var href = ($(this).attr('href') || '').replace(/\//g, ''); + APP.common.setLoginRedirect(href || 'login'); + }); + UI.alert(content); + }; + framework.onReady(function () { var priv = metadataMgr.getPrivateData(); @@ -2581,7 +2591,7 @@ define([ var loggedIn = framework._.sfCommon.isLoggedIn(); if (!loggedIn && !content.answers.anonymous) { - UI.alert(Messages.form_anonymous_blocked); + showAnonBlockedAlert(); } // If the results are public and there is at least one doodle, fetch the results now