You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB

Qr rotation dev (#400) * Fix #378 - Removing sesskey requirement for viewing attendance.php * Fix #378 - Show password icon when only QR code is selected. * Fix #378 - Refactor/Add functionality for QR Code & No Password * Changes to DB structure for rotateqrcode feature * Added Rotate QR code function * Adding new field to settings and DB create/update functions * Added function to check QR code pass and cookies, error messages. * Added function to return QR passwords as JSON * Moved unix timestamp generation to PHP * Added function that outputs JS to render the rotation code * Add QR code library qrcode.js * Added code to display and rotate the QR code. * Ammended password.php to not show text password when rotating. * Load information from database earlier, fixed check for password * Set expiry time for cookie * Autofill password for authenticated rotateqrcode users * Disable conflicting settings if rotateqr is enabled * Updating version number * Added maximum length to password field and amended key, name for table * Ammend upgrade.php to update db structure for qrcode rotation * Add id column to attendance_rotate_passwords * Removed interval setting from session. Using plugin setting instead. * Amend return passwords function * Update version numbers for DB/version.php * Hide rotate option when students cannot mark on update page. * Show QR icon when rotateqrcode is enabled. * Rename qrcoderotate JS file, frakenstyle * Add qrcode.js to thirdpartylibs.xml * Generate random password when rotateqrcode session is updated. * Add qrcodesecret column to database * Use separate password for rotateqrcode cookie * Remove unnecessary qrcodeinterval database field * Replacing $_GET with optional_param * Clarified time unit (seconds) for Rotate QR Code strings. * Moved rotateqrcodeinterval under studentscanmark setting * Fix code formatting in attendance.php and locallib.php * Add rotateqrcodesecret to structure * Add task to clear temporary qrrotation passwords * Functionality to allow password to be accepted if expired within 2sec * Documenting class clear_temporary_passwords * Updating delete temporary passwords task
6 years ago
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Attendance task - clear temporary passwords.
*
* @package mod_attendance
* @copyright 2019 Maksud R
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace mod_attendance\task;
defined('MOODLE_INTERNAL') || die();
/**
* clear_temporary_passwords class, used to clean up the temporary passwords.
*
* @package mod_attendance
* @copyright 2019 Maksud R
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class clear_temporary_passwords extends \core\task\scheduled_task {
/**
* Return the task's name as shown in admin screens.
*
* @return string
*/
public function get_name() {
return get_string('rotateqrcode_cleartemppass_task', 'mod_attendance');
}
/**
* Execute the task.
*/
public function execute() {
global $DB;
$params = array('currenttime' => time());
$DB->delete_records_select('attendance_rotate_passwords', 'expirytime < :currenttime', $params);
}
}