Skip to content

Commit

Permalink
Merge pull request #82 from catalyst/issue71
Browse files Browse the repository at this point in the history
Issue #71: Removed question file import
  • Loading branch information
brendanheywood authored Feb 26, 2020
2 parents 5b8ea5c + f8c4818 commit 252ef0c
Showing 5 changed files with 2 additions and 51 deletions.
2 changes: 0 additions & 2 deletions lang/en/tool_securityquestions.php
Original file line number Diff line number Diff line change
@@ -106,8 +106,6 @@
$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['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.';
39 changes: 0 additions & 39 deletions locallib.php
Original file line number Diff line number Diff line change
@@ -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.
*/
3 changes: 0 additions & 3 deletions set_questions.php
Original file line number Diff line number Diff line change
@@ -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 = '';
5 changes: 0 additions & 5 deletions settings.php
Original file line number Diff line number Diff line change
@@ -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'));
}
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 252ef0c

Please sign in to comment.