moodle-tool_mfa
moodle-tool_mfa copied to clipboard
Expose new api for other plugins to leverage \tool_mfa\manager::require_recent_auth($timeseconds)
eg something like this in a quiz access rule:
\tool_mfa\manager::require_recent_auth(10 * MINSECS, $allowajax = false)
means if you have just logged in then you go straight in, or if you have been elsewhere on the site for more then 10 minutes then you need to do an MFA challenge again.
The allow ajax flag tells us whether we should hard block ajax calls in the current session or only intercept main html page requests. This is to allow for page loads which are just near the 10 minute mark and the page loads but then an ajax call inside that page might fail otherwise.