admin: Enable admins to toggle supported auth methods via UI.

Add a table to the administration page that will allow realm admins to
activate and deactivate the supported authentication methods for that
realm.
This commit is contained in:
umkay
2016-11-02 13:51:56 -07:00
committed by Tim Abbott
parent 21c024fc29
commit f4c621ffe3
14 changed files with 235 additions and 10 deletions

View File

@@ -529,6 +529,52 @@ casper.waitUntilVisible('#admin-realm-default-language-status', function () {
casper.test.assertSelectorHasText('#admin-realm-default-language-status', 'Default language changed!');
});
// Test authentication methods setting
casper.waitForSelector('input[type="checkbox"]', function () {
casper.click(".method_row[data-method='Email'] input[type='checkbox']");
casper.click('form.admin-realm-form input.button');
});
// Test setting was activated--default is checked
casper.then(function () {
// Scroll to bottom so that casper snapshots show the auth methods table
this.scrollToBottom();
// Test setting was activated
casper.waitUntilVisible('#admin-realm-authentication-methods-status', function () {
casper.test.assertSelectorHasText('#admin-realm-authentication-methods-status', 'Authentication methods saved!');
casper.test.assertEval(function () {
return !(document.querySelector(".method_row[data-method='Email'] input[type='checkbox']").checked);
});
});
});
casper.then(function () {
// Leave the page and return
casper.click('#settings-dropdown');
casper.click('a[href^="#subscriptions"]');
casper.click('#settings-dropdown');
casper.click('a[href^="#administration"]');
casper.waitForSelector(".method_row[data-method='Email'] input[type='checkbox']", function () {
// Test Setting was saved
casper.test.assertEval(function () {
return !(document.querySelector(".method_row[data-method='Email'] input[type='checkbox']").checked);
});
});
});
// Deactivate setting--default is checked
casper.then(function () {
casper.click(".method_row[data-method='Email'] input[type='checkbox']");
casper.click('form.admin-realm-form input.button');
casper.waitUntilVisible('#admin-realm-authentication-methods-status', function () {
casper.test.assertSelectorHasText('#admin-realm-authentication-methods-status', 'Authentication methods saved!');
casper.test.assertEval(function () {
return document.querySelector(".method_row[data-method='Email'] input[type='checkbox']").checked;
});
});
});
common.then_log_out();
casper.run(function () {

View File

@@ -216,6 +216,26 @@ function render(template_name, args) {
assert.equal(count.text(), 99);
}());
(function admin_auth_methods_list() {
var args = {
method: {
"method": "Email",
"enabled": false
}
};
var html = '';
html += '<tbody id="admin_auth_methods_table">';
html += render('admin_auth_methods_list', args);
html += '</tbody>';
global.write_test_output('admin_auth_methods_list.handlebars', html);
var method = $(html).find('tr.method_row:first span.method');
assert.equal(method.text(), 'Email');
assert.equal(method.is("checked"), false);
}());
(function bookend() {
// Do subscribed/unsubscribed cases here.
var args = {