From 0cad04a5582a90d262e766f428057e41c68a0e8f Mon Sep 17 00:00:00 2001 From: Peter Burnett Date: Wed, 26 Feb 2020 12:20:32 +1000 Subject: [PATCH 1/2] Issue #71: Removed question file control --- lang/en/tool_securityquestions.php | 4 +-- locallib.php | 39 ------------------------------ set_questions.php | 3 --- settings.php | 5 ---- 4 files changed, 1 insertion(+), 50 deletions(-) diff --git a/lang/en/tool_securityquestions.php b/lang/en/tool_securityquestions.php index 47b57f6..ac8e747 100644 --- a/lang/en/tool_securityquestions.php +++ b/lang/en/tool_securityquestions.php @@ -106,9 +106,7 @@ $string['settingsinjectsetpw'] = 'Set password form.'; $string['settingslockoutnum'] = 'Answer attempts before lockout'; $string['settingslockoutnumdesc'] = 'The number of attempts at answering questions a user is allowed before being locked out of password resetting. Set this control to 0 to disable locking.'; -$string['settingsquestionfile'] = 'Question file to use'; -$string['settingsquestionfiledesc'] = 'Enter the filepath of a question file you would like to use to add questions.'; -$string['settingsmandatoryquestions'] = 'Mandatory security questions'; +$string['settingsmandatoryquestions'] = 'Mandatory Security Questions'; $string['settingsmandatoryquestionsdesc'] = 'Enable this control to make security questions mandatory. If disabled, users will still be prompted to answer questions on login, but they will be able to navigate away. On next login they will again be prompted.'; $string['settingsgraceperiod'] = 'Response grace period'; diff --git a/locallib.php b/locallib.php index ce1194b..4a8c06f 100644 --- a/locallib.php +++ b/locallib.php @@ -716,45 +716,6 @@ function tool_securityquestions_clear_user_responses($user) { set_user_preference('tool_securityquestions_logintime', time()); } -// Template File Functions. -/** - * Reads a question template file, and inserts all questions - * - * @param string $filepath the path to the question template file - */ -function tool_securityquestions_read_questions_file($filepath) { - - if (file_exists($filepath)) { - try { - $questions = fopen($filepath, 'r'); - } catch (Exception $e) { - return false; - } - } - - if (!empty($questions)) { - while (!feof($questions)) { - $question = trim(fgets($questions)); - tool_securityquestions_insert_question($question); - } - } - - return true; -} - -/** - * Forces use of a template file if the admin config specifies one - */ -function tool_securityquestions_use_template_file() { - global $CFG; - $file = get_config('tool_securityquestions', 'questionfile'); - if ($file !== '') { - // If a filepath is set, use that config file. - $path = $CFG->wwwroot.$file; - tool_securityquestions_read_questions_file($path); - } -} - /** * Generates the select array for use in setting resposes. */ diff --git a/set_questions.php b/set_questions.php index 6116d03..2e95c5a 100644 --- a/set_questions.php +++ b/set_questions.php @@ -30,9 +30,6 @@ admin_externalpage_setup('tool_securityquestions_setform'); -// If a template is in use, apply it. -tool_securityquestions_use_template_file(); - // Setup notification block. $notifyadd = false; $notifyaddcontent = ''; diff --git a/settings.php b/settings.php index affa87a..23ebe42 100644 --- a/settings.php +++ b/settings.php @@ -102,10 +102,5 @@ $settings->add(new admin_setting_configtext('tool_securityquestions/lockoutnum', get_string('settingslockoutnum', 'tool_securityquestions'), get_string('settingslockoutnumdesc', 'tool_securityquestions'), 3, PARAM_INT)); - - $settings->add(new admin_setting_configfile('tool_securityquestions/questionfile', - get_string('settingsquestionfile', 'tool_securityquestions'), - get_string('settingsquestionfile', 'tool_securityquestions'), - '/admin/tool/securityquestions/questions/example.txt')); } } From f8c48188014c054ade946a2ddc0c99dcbe6fe9f8 Mon Sep 17 00:00:00 2001 From: Peter Burnett Date: Wed, 26 Feb 2020 12:22:46 +1000 Subject: [PATCH 2/2] Version Bump --- lang/en/tool_securityquestions.php | 2 +- version.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/en/tool_securityquestions.php b/lang/en/tool_securityquestions.php index ac8e747..1575b23 100644 --- a/lang/en/tool_securityquestions.php +++ b/lang/en/tool_securityquestions.php @@ -106,7 +106,7 @@ $string['settingsinjectsetpw'] = 'Set password form.'; $string['settingslockoutnum'] = 'Answer attempts before lockout'; $string['settingslockoutnumdesc'] = 'The number of attempts at answering questions a user is allowed before being locked out of password resetting. Set this control to 0 to disable locking.'; -$string['settingsmandatoryquestions'] = 'Mandatory Security Questions'; +$string['settingsmandatoryquestions'] = 'Mandatory security questions'; $string['settingsmandatoryquestionsdesc'] = 'Enable this control to make security questions mandatory. If disabled, users will still be prompted to answer questions on login, but they will be able to navigate away. On next login they will again be prompted.'; $string['settingsgraceperiod'] = 'Response grace period'; diff --git a/version.php b/version.php index d446c68..8abc6c3 100644 --- a/version.php +++ b/version.php @@ -24,8 +24,8 @@ defined('MOODLE_INTERNAL') || die; -$plugin->version = 2020021300; -$plugin->release = 2020021300; // Match release exactly to version. +$plugin->version = 2020022600; +$plugin->release = 2020022600; // Match release exactly to version. $plugin->requires = 2016052300; $plugin->component = 'tool_securityquestions'; $plugin->maturity = MATURITY_STABLE;