diff --git a/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue new file mode 100644 index 00000000..4b27d825 --- /dev/null +++ b/src/components/Pages/ManageWiki/Cards/QuestyCaptcha.vue @@ -0,0 +1,242 @@ + + + + + diff --git a/src/components/Pages/ManageWiki/Tabs/ManageWiki.vue b/src/components/Pages/ManageWiki/Tabs/ManageWiki.vue index baaa7773..777a318b 100644 --- a/src/components/Pages/ManageWiki/Tabs/ManageWiki.vue +++ b/src/components/Pages/ManageWiki/Tabs/ManageWiki.vue @@ -19,6 +19,11 @@ + + + + + @@ -62,10 +67,12 @@ import Skin from '~/components/Pages/ManageWiki/Cards/Skin' import Registration from '~/components/Pages/ManageWiki/Cards/Registration' import Wikibase from '~/components/Pages/ManageWiki/Cards/Wikibase' import Delete from '~/components/Pages/ManageWiki/Cards/Delete' +import QuestyCaptcha from '../Cards/QuestyCaptcha' export default { name: 'ManageWiki', components: { + QuestyCaptcha, Details, Logo, Skin, diff --git a/src/store/wikis.js b/src/store/wikis.js index db643140..78716388 100644 --- a/src/store/wikis.js +++ b/src/store/wikis.js @@ -60,6 +60,20 @@ const mutations = { const defaultMapping = { properties: { P31: MAPPING_SUGGESTION_PLACEHOLDER, P279: MAPPING_SUGGESTION_PLACEHOLDER }, items: {} } const wikibaseManifestEquivEntities = entityMappingSetting ? JSON.parse(entityMappingSetting.value) : defaultMapping + const wwUseQuestyCaptchaSetting = details.public_settings.find(setting => setting.name === 'wwUseQuestyCaptcha') + const wwUseQuestyCaptcha = wwUseQuestyCaptchaSetting ? parseInt(wwUseQuestyCaptchaSetting.value) === 1 : false + + const captchaQuestionsSetting = details.public_settings.find(setting => setting.name === 'wwCaptchaQuestions') + const defaultQuestions = [ + { question: 'How many vowels are in this question?', answers: ['12', 'twelve'] }, + { question: 'What is the chemical formula of water?', answers: ['H2O'] }, + { question: '2 + 4 = ?', answers: ['6', 'six'] } + ] + const captchaQuestions = captchaQuestionsSetting + ? Object.entries(JSON.parse(captchaQuestionsSetting.value)).map(([key, value]) => { + return { question: key, answers: value } + }) : undefined + const federatedPropertiesSetting = details.public_settings.find(setting => setting.name === 'wikibaseFedPropsEnable') const wikibaseFedPropsEnable = federatedPropertiesSetting ? parseInt(federatedPropertiesSetting.value) === 1 : false @@ -90,7 +104,10 @@ const mutations = { wwWikibaseStringLengthString, wwWikibaseStringLengthMonolingualText, wwWikibaseStringLengthMultilang, - wwExtEnableConfirmAccount + wwExtEnableConfirmAccount, + wwUseQuestyCaptcha, + captchaQuestions, + defaultQuestions } }, clear_current_wiki_settings (state) { @@ -119,6 +136,12 @@ const mutations = { }, set_enable_confirm_account (state, { value }) { state.currentWikiSettings.wwExtEnableConfirmAccount = value + }, + set_enable_questy_captcha (state, { value }) { + state.currentWikiSettings.wwUseQuestyCaptcha = value + }, + set_questy_captcha_questions (state, value) { + state.currentWikiSettings.captchaQuestions = value } } @@ -186,6 +209,12 @@ const actions = { items: filterOutPlaceholderMapping(mapping.items) }) }) + }, + setEnabledQuestyCaptcha ({ commit }, enabled) { + commit('set_enable_questy_captcha', enabled) + }, + setQuestyCaptchaQuestions ({ commit }, value) { + commit('set_questy_captcha_questions', value) } }