function ga_login_update_8001 in Google Authenticator login 8
Set TOTP time limit to 1 min if set to the old default value of 15 mins.
File
- ./
ga_login.install, line 37 - Installation related functions for GA Login module.
Code
function ga_login_update_8001() {
$config = \Drupal::configFactory()
->getEditable('tfa.settings');
if (in_array('tfa_totp', $config
->get('allowed_validation_plugins'))) {
$time_skew = $config
->get('validation_plugin_settings.tfa_totp.time_skew');
if (!empty($time_skew) && $time_skew == 30) {
$config
->set('validation_plugin_settings.tfa_totp.time_skew', 2)
->save();
\Drupal::logger('ga_login')
->info('TOTP time skew changed to limit valid code lifespan to one minute.');
}
}
}