T606: Fix refreshing list of auth factors after adding/removing them
This commit is contained in:
parent
68477e014d
commit
7c81d3f1dd
2 changed files with 14 additions and 4 deletions
|
@ -30,6 +30,10 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
||||||
var highsec_dialog;
|
var highsec_dialog;
|
||||||
var factor_dialog;
|
var factor_dialog;
|
||||||
|
|
||||||
|
if (!rcmail.env.kolab_2fa_factors) {
|
||||||
|
rcmail.env.kolab_2fa_factors = {};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equivalend of PHP time()
|
* Equivalend of PHP time()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -459,7 +459,7 @@ class kolab_2fa extends rcube_plugin
|
||||||
}
|
}
|
||||||
|
|
||||||
$me = $this;
|
$me = $this;
|
||||||
$this->api->output->set_env('kolab_2fa_factors', array_combine(
|
$factors = array_combine(
|
||||||
$factors,
|
$factors,
|
||||||
array_map(function($id) use ($me, &$env_methods) {
|
array_map(function($id) use ($me, &$env_methods) {
|
||||||
$props = array('id' => $id);
|
$props = array('id' => $id);
|
||||||
|
@ -473,9 +473,10 @@ class kolab_2fa extends rcube_plugin
|
||||||
|
|
||||||
return $props;
|
return $props;
|
||||||
}, $factors)
|
}, $factors)
|
||||||
));
|
);
|
||||||
|
|
||||||
$this->api->output->set_env('kolab_2fa_methods', $env_methods);
|
$this->api->output->set_env('kolab_2fa_methods', $env_methods);
|
||||||
|
$this->api->output->set_env('kolab_2fa_factors', !empty($factors) ? $factors : null);
|
||||||
|
|
||||||
return html::div(array('id' => 'kolab2fapropform'), $out);
|
return html::div(array('id' => 'kolab2fapropform'), $out);
|
||||||
}
|
}
|
||||||
|
@ -640,7 +641,10 @@ class kolab_2fa extends rcube_plugin
|
||||||
|
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->api->output->show_message($data === false ? $this->gettext('factorremovesuccess') : $this->gettext('factorsavesuccess'), 'confirmation');
|
$this->api->output->show_message($data === false ? $this->gettext('factorremovesuccess') : $this->gettext('factorsavesuccess'), 'confirmation');
|
||||||
$this->api->output->command('plugin.save_success', array('method' => $method, 'active' => $data !== false) + $save_data);
|
$this->api->output->command('plugin.save_success', array(
|
||||||
|
'method' => $method,
|
||||||
|
'active' => $data !== false,
|
||||||
|
'id' => $driver->id) + $save_data);
|
||||||
}
|
}
|
||||||
else if ($errors) {
|
else if ($errors) {
|
||||||
$this->api->output->show_message($this->gettext('factorsaveerror'), 'error');
|
$this->api->output->show_message($this->gettext('factorsaveerror'), 'error');
|
||||||
|
@ -707,6 +711,7 @@ class kolab_2fa extends rcube_plugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = $driver->verify(rcube_utils::get_input_value('_code', rcube_utils::INPUT_POST), $timestamp);
|
$success = $driver->verify(rcube_utils::get_input_value('_code', rcube_utils::INPUT_POST), $timestamp);
|
||||||
$method = $driver->method;
|
$method = $driver->method;
|
||||||
}
|
}
|
||||||
|
@ -722,6 +727,7 @@ class kolab_2fa extends rcube_plugin
|
||||||
'message' => str_replace('$method', $this->gettext($method),
|
'message' => str_replace('$method', $this->gettext($method),
|
||||||
$this->gettext($success ? 'codeverificationpassed' : 'codeverificationfailed'))
|
$this->gettext($success ? 'codeverificationpassed' : 'codeverificationfailed'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->api->output->send();
|
$this->api->output->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue