Elastic skin support for kolab_2fa
This commit is contained in:
parent
fe64e470c8
commit
a3a1691cde
3 changed files with 63 additions and 27 deletions
|
@ -51,10 +51,13 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
var rows = 0;
|
||||
$.each(rcmail.env.kolab_2fa_factors, function(id, props) {
|
||||
if (props.active) {
|
||||
var tr = $('<tr>').addClass(props.method).appendTo(table);
|
||||
var tr = $('<tr>').addClass(props.method).appendTo(table),
|
||||
button = $('<a class="button icon delete">').attr({href: '#', rel: id})
|
||||
.append($('<span class="inner">').text(rcmail.get_label('remove','kolab_2fa')));
|
||||
|
||||
$('<td>').addClass('name').text(props.label || props.name).appendTo(tr);
|
||||
$('<td>').addClass('created').text(props.created || '??').appendTo(tr);
|
||||
$('<td>').addClass('actions').html('<a class="button delete" rel="'+id+'">' + rcmail.get_label('remove','kolab_2fa') + '</a>').appendTo(tr);
|
||||
$('<td>').addClass('actions buttons-cell').append(button).appendTo(tr);
|
||||
rows++;
|
||||
}
|
||||
});
|
||||
|
@ -80,13 +83,14 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
[
|
||||
{
|
||||
text: rcmail.gettext('save', 'kolab_2fa'),
|
||||
'class': 'mainaction',
|
||||
'class': 'mainaction save',
|
||||
click: function(e) {
|
||||
save_data(method);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: rcmail.gettext('cancel'),
|
||||
'class': 'cancel',
|
||||
click: function() {
|
||||
factor_dialog.dialog('close');
|
||||
}
|
||||
|
@ -106,7 +110,6 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
}
|
||||
}
|
||||
)
|
||||
.addClass('propform')
|
||||
.data('method', method)
|
||||
.data('timestamp', time());
|
||||
|
||||
|
@ -224,10 +227,11 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
|
|||
highsec_dialog.find('input[name="_code"]').select();
|
||||
}
|
||||
},
|
||||
'class': 'mainaction'
|
||||
'class': 'mainaction save'
|
||||
},
|
||||
{
|
||||
text: rcmail.gettext('cancel'),
|
||||
'class': 'cancel',
|
||||
click: function() {
|
||||
highsec_dialog.dialog('close');
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
/**
|
||||
* Kolab 2-Factor-Authentication plugin
|
||||
*
|
||||
* ...
|
||||
*
|
||||
* @author Thomas Bruederli <bruederli@kolabsys.com>
|
||||
*
|
||||
* Copyright (C) 2015, Kolab Systems AG <contact@kolabsys.com>
|
||||
|
@ -252,8 +250,14 @@ class kolab_2fa extends rcube_plugin
|
|||
}
|
||||
|
||||
$field_id = "rcmlogin2fa$method";
|
||||
$input_code = new html_inputfield(array('name' => "_${nonce}_${method}", 'class' => 'kolab2facode', 'id' => $field_id, 'required' => $required, 'autocomplete' => 'off')
|
||||
+ $attrib);
|
||||
$input_code = new html_inputfield(array(
|
||||
'name' => "_${nonce}_${method}",
|
||||
'class' => 'kolab2facode',
|
||||
'id' => $field_id,
|
||||
'required' => $required,
|
||||
'autocomplete' => 'off',
|
||||
'data-icon' => 'key' // for Elastic
|
||||
) + $attrib);
|
||||
$table->add('title', html::label($field_id, html::quote($this->gettext($method))));
|
||||
$table->add('input', $input_code->show(''));
|
||||
}
|
||||
|
@ -266,9 +270,12 @@ class kolab_2fa extends rcube_plugin
|
|||
|
||||
// add submit button
|
||||
if (rcube_utils::get_boolean($attrib['submit'])) {
|
||||
$submit = new html_inputfield(array('type' => 'submit', 'id' => 'rcmloginsubmit',
|
||||
'class' => 'button mainaction', 'value' => $this->gettext('continue')));
|
||||
$out .= html::p('formbuttons', $submit->show());
|
||||
$out .= html::p('formbuttons', html::tag('button', array(
|
||||
'type' => 'submit',
|
||||
'id' => 'rcmloginsubmit',
|
||||
'class' => 'button mainaction save',
|
||||
), $this->gettext('continue'))
|
||||
);
|
||||
}
|
||||
|
||||
// surround html output with a form tag
|
||||
|
@ -415,7 +422,9 @@ class kolab_2fa extends rcube_plugin
|
|||
{
|
||||
$rcmail = rcmail::get_instance();
|
||||
|
||||
$select = new html_select(array('id' => 'kolab2fa-add'));
|
||||
$attrib['id'] = 'kolab2fa-add';
|
||||
|
||||
$select = new html_select($attrib);
|
||||
$select->add($this->gettext('addfactor') . '...', '');
|
||||
foreach ((array)$rcmail->config->get('kolab_2fa_drivers', array()) as $method) {
|
||||
$select->add($this->gettext($method), $method);
|
||||
|
@ -515,7 +524,7 @@ class kolab_2fa extends rcube_plugin
|
|||
}
|
||||
|
||||
$explain_label = $field . 'explain' . $method;
|
||||
$explain_html = $rcmail->text_exists($explain_label, 'kolab_2fa') ? html::p('explain', $this->gettext($explain_label)) : '';
|
||||
$explain_html = $rcmail->text_exists($explain_label, 'kolab_2fa') ? html::div('explain form-text', $this->gettext($explain_label)) : '';
|
||||
|
||||
$field_id = 'rcmk2fa' . $method . $field;
|
||||
$table->add('title', html::label($field_id, $this->gettext($field)));
|
||||
|
@ -526,12 +535,8 @@ class kolab_2fa extends rcube_plugin
|
|||
if (method_exists($driver, 'get_provisioning_uri')) {
|
||||
$table->add('title', $this->gettext('qrcode'));
|
||||
$table->add(null,
|
||||
html::p('explain',
|
||||
$this->gettext("qrcodeexplain$method")
|
||||
) .
|
||||
html::p(null,
|
||||
html::tag('img', array('src' => 'data:image/gif;base64,R0lGODlhDwAPAIAAAMDAwAAAACH5BAEAAAAALAAAAAAPAA8AQAINhI+py+0Po5y02otnAQA7', 'class' => 'qrcode', 'rel' => $method))
|
||||
)
|
||||
html::div('explain form-text', $this->gettext("qrcodeexplain$method"))
|
||||
. html::tag('img', array('src' => 'data:image/gif;base64,R0lGODlhDwAPAIAAAMDAwAAAACH5BAEAAAAALAAAAAAPAA8AQAINhI+py+0Po5y02otnAQA7', 'class' => 'qrcode', 'rel' => $method))
|
||||
);
|
||||
|
||||
// add row for testing the factor
|
||||
|
@ -539,7 +544,7 @@ class kolab_2fa extends rcube_plugin
|
|||
$table->add('title', html::label($field_id, $this->gettext('verifycode')));
|
||||
$table->add(null,
|
||||
html::tag('input', array('type' => 'text', 'name' => '_verify_code', 'id' => $field_id, 'class' => 'k2fa-verify', 'size' => 20, 'required' => true)) .
|
||||
html::p('explain', $this->gettext("verifycodeexplain$method"))
|
||||
html::div('explain form-text', $this->gettext("verifycodeexplain$method"))
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -549,8 +554,9 @@ class kolab_2fa extends rcube_plugin
|
|||
$out .= html::tag('form', array(
|
||||
'method' => 'post',
|
||||
'action' => '#',
|
||||
'id' => 'kolab2fa-prop-' . $method,
|
||||
'style' => 'display:none',
|
||||
'id' => 'kolab2fa-prop-' . $method,
|
||||
'style' => 'display:none',
|
||||
'class' => 'propform',
|
||||
),
|
||||
html::tag('fieldset', array(),
|
||||
html::tag('legend', array(), $this->gettext($method)) .
|
||||
|
@ -562,9 +568,9 @@ class kolab_2fa extends rcube_plugin
|
|||
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render th
|
||||
* Render the high-security-dialog content
|
||||
*/
|
||||
public function settings_highsecuritydialog($attrib = array())
|
||||
{
|
||||
|
@ -572,10 +578,11 @@ class kolab_2fa extends rcube_plugin
|
|||
|
||||
$field_id = 'rcmk2facode';
|
||||
$input = new html_inputfield(array('name' => '_code', 'id' => $field_id, 'class' => 'verifycode', 'size' => 20));
|
||||
$label = html::label(array('for' => $field_id, 'class' => 'col-form-label col-sm-4'), '$name');
|
||||
|
||||
return html::div($attrib,
|
||||
html::p('explain', $this->gettext('highsecuritydialog')) .
|
||||
html::div('propform', html::label($field_id, '$name') . $input->show(''))
|
||||
html::div('explain form-text', $this->gettext('highsecuritydialog'))
|
||||
. html::div('propform row form-group', $label . html::div('col-sm-8', $input->show('')))
|
||||
);
|
||||
}
|
||||
|
||||
|
|
25
plugins/kolab_2fa/skins/elastic/templates/config.html
Normal file
25
plugins/kolab_2fa/skins/elastic/templates/config.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
<roundcube:include file="includes/layout.html" />
|
||||
<roundcube:include file="includes/menu.html" />
|
||||
<roundcube:include file="includes/settings-menu.html" />
|
||||
|
||||
<h1 class="voice"><roundcube:label name="kolab_2fa.settingstitle" /></h1>
|
||||
|
||||
<div class="content selected no-navbar" role="main">
|
||||
<h2 id="aria-label-toolbar" class="voice"><roundcube:label name="arialabeltoolbar" /></h2>
|
||||
<div class="header" role="toolbar" aria-labelledby="aria-label-toolbar">
|
||||
<a class="button icon back-list-button" href="#back"><span class="inner"><roundcube:label name="back" /></span></a>
|
||||
<span class="header-title"><roundcube:label name="kolab_2fa.settingstitle" /></span>
|
||||
<div class="toolbar"></div>
|
||||
</div>
|
||||
<div class="scroller frame-content">
|
||||
<p class="addfactor">
|
||||
<roundcube:object name="plugin.factoradder" class="form-control" />
|
||||
</p>
|
||||
<roundcube:object name="plugin.settingslist" class="authentication-factors" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<roundcube:object name="plugin.settingsform" class="propform" />
|
||||
<roundcube:object name="plugin.highsecuritydialog" class="kolab2fa-highsecuritydialog hidden" />
|
||||
|
||||
<roundcube:include file="includes/footer.html" />
|
Loading…
Add table
Reference in a new issue