mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
Working on implementing the jQuery Validation plugin for the authentication settings editor.
This commit is contained in:
parent
a4b6fba2be
commit
cf62890fcf
@ -267,6 +267,38 @@ let AuthenticationSettingsModel = function (user_data, api_url, csrf_token, sele
|
|||||||
return self.ldap_enabled() === 1 && self.autoprovisioning() === 1;
|
return self.ldap_enabled() === 1 && self.autoprovisioning() === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let google_oauth_auto_configure_enabled = function (element) {
|
||||||
|
return self.google_oauth_enabled() && self.google_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let google_oauth_auto_configure_disabled = function (element) {
|
||||||
|
return self.google_oauth_enabled() && !self.google_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let github_oauth_auto_configure_enabled = function (element) {
|
||||||
|
return self.github_oauth_enabled() && self.github_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let github_oauth_auto_configure_disabled = function (element) {
|
||||||
|
return self.github_oauth_enabled() && !self.github_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let azure_oauth_auto_configure_enabled = function (element) {
|
||||||
|
return self.azure_oauth_enabled() && self.azure_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let azure_oauth_auto_configure_disabled = function (element) {
|
||||||
|
return self.azure_oauth_enabled() && !self.azure_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let oidc_oauth_auto_configure_enabled = function (element) {
|
||||||
|
return self.oidc_oauth_enabled() && self.oidc_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
|
let oidc_oauth_auto_configure_disabled = function (element) {
|
||||||
|
return self.oidc_oauth_enabled() && !self.oidc_oauth_auto_configure();
|
||||||
|
}
|
||||||
|
|
||||||
jQuery.validator.addMethod('auth_enabled', auth_enabled, 'At least one authentication method must be enabled.');
|
jQuery.validator.addMethod('auth_enabled', auth_enabled, 'At least one authentication method must be enabled.');
|
||||||
jQuery.validator.addMethod('ldap_exclusive', ldap_exclusive, 'The LDAP group security and role auto-provisioning features are mutually exclusive.');
|
jQuery.validator.addMethod('ldap_exclusive', ldap_exclusive, 'The LDAP group security and role auto-provisioning features are mutually exclusive.');
|
||||||
|
|
||||||
@ -275,6 +307,7 @@ let AuthenticationSettingsModel = function (user_data, api_url, csrf_token, sele
|
|||||||
];
|
];
|
||||||
|
|
||||||
$(selector).validate({
|
$(selector).validate({
|
||||||
|
ignore: '',
|
||||||
errorPlacement: function (error, element) {
|
errorPlacement: function (error, element) {
|
||||||
let useFooter = false;
|
let useFooter = false;
|
||||||
for (let i = 0; i < footerErrorElements.length; i++) {
|
for (let i = 0; i < footerErrorElements.length; i++) {
|
||||||
@ -413,8 +446,94 @@ let AuthenticationSettingsModel = function (user_data, api_url, csrf_token, sele
|
|||||||
maxlength: 100,
|
maxlength: 100,
|
||||||
},
|
},
|
||||||
purge: ldap_enabled,
|
purge: ldap_enabled,
|
||||||
|
google_oauth_client_id: {
|
||||||
|
required: google_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
google_oauth_client_secret: {
|
||||||
|
required: google_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
google_oauth_scope: {
|
||||||
|
required: google_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
google_base_url: {
|
||||||
|
required: google_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
google_oauth_metadata_url: {
|
||||||
|
required: google_oauth_auto_configure_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
google_token_url: {
|
||||||
|
required: google_oauth_auto_configure_disabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
google_authorize_url: {
|
||||||
|
required: google_oauth_auto_configure_disabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
github_oauth_key: {
|
||||||
|
required: github_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
github_oauth_secret: {
|
||||||
|
required: github_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
github_oauth_scope: {
|
||||||
|
required: github_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
},
|
||||||
|
github_oauth_api_url: {
|
||||||
|
required: github_oauth_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
github_oauth_metadata_url: {
|
||||||
|
required: github_oauth_auto_configure_enabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
github_oauth_token_url: {
|
||||||
|
required: github_oauth_auto_configure_disabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
github_oauth_authorize_url: {
|
||||||
|
required: github_oauth_auto_configure_disabled,
|
||||||
|
minlength: 1,
|
||||||
|
maxlength: 255,
|
||||||
|
url: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
ldap_sg_enabled: {
|
||||||
|
ldap_exclusive: 'The LDAP group security feature is mutually exclusive with the LDAP role auto-provisioning feature.',
|
||||||
|
},
|
||||||
|
autoprovisioning: {
|
||||||
|
ldap_exclusive: 'The LDAP role auto-provisioning feature is mutually exclusive with the LDAP group security feature.',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
messages: {},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
<div data-bind="class: 'tab-pane' + (tab_active() == 'local' ? ' active' : '')">
|
<div data-tab="local" data-bind="class: 'tab-pane' + (tab_active() == 'local' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -280,7 +280,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
|
|
||||||
<div data-bind="class: 'tab-pane' + (tab_active() == 'ldap' ? ' active' : '')">
|
<div data-tab="ldap" data-bind="class: 'tab-pane' + (tab_active() == 'ldap' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
{% if error %}
|
{% if error %}
|
||||||
@ -744,7 +744,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
|
|
||||||
<div
|
<div data-tab="google"
|
||||||
data-bind="class: 'tab-pane' + (tab_active() == 'google' ? ' active' : '')">
|
data-bind="class: 'tab-pane' + (tab_active() == 'google' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
@ -803,7 +803,7 @@
|
|||||||
id="google_oauth_auto_configure"
|
id="google_oauth_auto_configure"
|
||||||
name="google_oauth_auto_configure"
|
name="google_oauth_auto_configure"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
data-bind="checked: google_oauth_auto_configure">
|
data-bind="enable: google_oauth_enabled, checked: google_oauth_auto_configure">
|
||||||
<label for="google_oauth_auto_configure">Enable
|
<label for="google_oauth_auto_configure">Enable
|
||||||
Google
|
Google
|
||||||
OAuth Auto-Configuration</label>
|
OAuth Auto-Configuration</label>
|
||||||
@ -869,7 +869,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
|
|
||||||
<div
|
<div data-tab="github"
|
||||||
data-bind="class: 'tab-pane' + (tab_active() == 'github' ? ' active' : '')">
|
data-bind="class: 'tab-pane' + (tab_active() == 'github' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
@ -927,7 +927,7 @@
|
|||||||
id="github_oauth_auto_configure"
|
id="github_oauth_auto_configure"
|
||||||
name="github_oauth_auto_configure"
|
name="github_oauth_auto_configure"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
data-bind="checked: github_oauth_auto_configure">
|
data-bind="enable: github_oauth_enabled, checked: github_oauth_auto_configure">
|
||||||
<label for="github_oauth_auto_configure">Enable
|
<label for="github_oauth_auto_configure">Enable
|
||||||
GitHub
|
GitHub
|
||||||
OAuth Auto-Configuration</label>
|
OAuth Auto-Configuration</label>
|
||||||
@ -991,7 +991,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
|
|
||||||
<div data-bind="class: 'tab-pane' + (tab_active() == 'azure' ? ' active' : '')">
|
<div data-tab="azure" data-bind="class: 'tab-pane' + (tab_active() == 'azure' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -1049,7 +1049,7 @@
|
|||||||
id="azure_oauth_auto_configure"
|
id="azure_oauth_auto_configure"
|
||||||
name="azure_oauth_auto_configure"
|
name="azure_oauth_auto_configure"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
data-bind="checked: azure_oauth_auto_configure">
|
data-bind="enable: azure_oauth_enabled, checked: azure_oauth_auto_configure">
|
||||||
<label for="azure_oauth_auto_configure">Enable Azure
|
<label for="azure_oauth_auto_configure">Enable Azure
|
||||||
OAuth Auto-Configuration</label>
|
OAuth Auto-Configuration</label>
|
||||||
</div>
|
</div>
|
||||||
@ -1293,7 +1293,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- /.tab-pane -->
|
<!-- /.tab-pane -->
|
||||||
|
|
||||||
<div data-bind="class: 'tab-pane' + (tab_active() == 'oidc' ? ' active' : '')">
|
<div data-tab="oidc" data-bind="class: 'tab-pane' + (tab_active() == 'oidc' ? ' active' : '')">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-sm-6 col-lg-4">
|
<div class="col-12 col-sm-6 col-lg-4">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -1349,7 +1349,7 @@
|
|||||||
id="oidc_oauth_auto_configure"
|
id="oidc_oauth_auto_configure"
|
||||||
name="oidc_oauth_auto_configure"
|
name="oidc_oauth_auto_configure"
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
data-bind="checked: oidc_oauth_auto_configure">
|
data-bind="enable: oidc_oauth_enabled, checked: oidc_oauth_auto_configure">
|
||||||
<label for="oidc_oauth_auto_configure">Enable OIDC
|
<label for="oidc_oauth_auto_configure">Enable OIDC
|
||||||
OAuth Auto-Configuration</label>
|
OAuth Auto-Configuration</label>
|
||||||
</div>
|
</div>
|
||||||
@ -1509,8 +1509,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block head_styles %}
|
{% block head_styles %}
|
||||||
<style type="text/css">
|
<style>
|
||||||
.error { color: red; }
|
.error { color: red!important; }
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user