refactoring
This commit is contained in:
parent
726f1e13b4
commit
b12ba2369e
|
@ -560,13 +560,11 @@ class WebauthnProvider extends BaseProvider {
|
|||
$row->add($loginButton, 12);
|
||||
$errorMessage = new htmlStatusMessage('ERROR', '', _('This service requires a browser with "WebAuthn" support.'));
|
||||
$row->add(new htmlDiv(null, $errorMessage, array('hidden webauthn-error')), 12);
|
||||
if ($this->config->twoFactorAuthenticationOptional === true) {
|
||||
if (!$hasTokens) {
|
||||
if (($this->config->twoFactorAuthenticationOptional === true) && !$hasTokens) {
|
||||
$skipButton = new htmlButton('skip_webauthn', _('Skip'));
|
||||
$skipButton->setCSSClasses(array('fullwidth'));
|
||||
$row->add($skipButton, 12);
|
||||
}
|
||||
}
|
||||
$errorMessageDiv = new htmlDiv('generic-webauthn-error', new htmlOutputText(''));
|
||||
$errorMessageDiv->addDataAttribute('button', _('Ok'));
|
||||
$errorMessageDiv->addDataAttribute('title', _('Webauthn failed'));
|
||||
|
|
|
@ -110,12 +110,13 @@ if (ini_get("session.auto_start") == "1") {
|
|||
}
|
||||
// check memory limit
|
||||
$memLimit = ini_get('memory_limit');
|
||||
if (isset($memLimit) && ($memLimit != '') && (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')) {
|
||||
if (intval(substr($memLimit, 0, strlen($memLimit) - 1)) < 128) {
|
||||
if (isset($memLimit)
|
||||
&& ($memLimit != '')
|
||||
&& (substr(strtoupper($memLimit), strlen($memLimit) - 1) == 'M')
|
||||
&& (intval(substr($memLimit, 0, strlen($memLimit) - 1)) < 128)) {
|
||||
$criticalErrors[] = array("ERROR", "Please increase the \"memory_limit\" parameter in your php.ini to at least \"128M\".",
|
||||
"Your current memory limit is $memLimit.");
|
||||
}
|
||||
}
|
||||
// check PCRE regex system
|
||||
if (!@preg_match('/^\p{L}+$/u', "abc")) {
|
||||
$criticalErrors[] = array("ERROR", "Your PCRE library has no complete Unicode support. Please upgrade libpcre or compile with \"--enable-unicode-properties\".");
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2003 - 2019 Roland Gruber
|
||||
Copyright (C) 2003 - 2020 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -144,11 +144,11 @@ class Ldap{
|
|||
$file = @readdir($dir);
|
||||
while ($file) {
|
||||
$path = $tmpDir . $file;
|
||||
if ((substr($file, 0, 1) != '.') && !is_dir($path)) {
|
||||
if ($time - filemtime($path) > 900) {
|
||||
if ((substr($file, 0, 1) != '.')
|
||||
&& !is_dir($path)
|
||||
&& ($time - filemtime($path) > 900)) {
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
$file = @readdir($dir);
|
||||
}
|
||||
@closedir($dir);
|
||||
|
|
|
@ -1779,11 +1779,9 @@ class accountContainer {
|
|||
// pass profile to each module
|
||||
$modules = array_keys($this->module);
|
||||
foreach ($modules as $module) $this->module[$module]->load_profile($profile);
|
||||
if (isset($profile['ldap_rdn'][0])) {
|
||||
if (in_array($profile['ldap_rdn'][0], getRDNAttributes($this->type->getId()))) {
|
||||
if (isset($profile['ldap_rdn'][0]) && in_array($profile['ldap_rdn'][0], getRDNAttributes($this->type->getId()))) {
|
||||
$this->rdn = $profile['ldap_rdn'][0];
|
||||
}
|
||||
}
|
||||
if (isset($profile['ldap_suffix'][0]) && ($profile['ldap_suffix'][0] != '-')) {
|
||||
$this->dnSuffix = $profile['ldap_suffix'][0];
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
This code is not yet part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2011 J de Jong
|
||||
2012 - 2019 Roland Gruber
|
||||
2012 - 2020 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -230,11 +230,11 @@ class authorizedServiceObject extends baseModule {
|
|||
// profile mappings in meta data
|
||||
parent::load_profile($profile);
|
||||
// add extension
|
||||
if (isset($profile['authorizedServiceObject_addExt'][0]) && ($profile['authorizedServiceObject_addExt'][0] == "true")) {
|
||||
if (!in_array('authorizedServiceObject', $this->attributes['objectClass'])) {
|
||||
if (isset($profile['authorizedServiceObject_addExt'][0])
|
||||
&& ($profile['authorizedServiceObject_addExt'][0] == "true")
|
||||
&& !in_array('authorizedServiceObject', $this->attributes['objectClass'])) {
|
||||
$this->attributes['objectClass'][] = 'authorizedServiceObject';
|
||||
}
|
||||
}
|
||||
// add ASs
|
||||
if (isset ($profile['authorizedServiceObject_services'][0]) && ($profile['authorizedServiceObject_services'][0] != "")) {
|
||||
$services = explode(',', $profile['authorizedServiceObject_services'][0]);
|
||||
|
|
|
@ -281,11 +281,9 @@ class ddns extends baseModule {
|
|||
$this->setIgnoreClientUpdates(($client_insert == 'on'));
|
||||
|
||||
$this->setUpdateKey($key_path);
|
||||
if (!empty($key_path)) {
|
||||
if (str_replace("\"","",$_POST['key_path']) != $key_path) {
|
||||
if (!empty($key_path) && (str_replace("\"","",$_POST['key_path']) != $key_path)) {
|
||||
$errors[] = $this->messages['key_path'][1];
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
|
@ -301,11 +299,9 @@ class ddns extends baseModule {
|
|||
$zone_reverse = trim($_POST['zone_reverse']);
|
||||
|
||||
// ip correct???
|
||||
if (!empty($ip)) {
|
||||
if (!check_ip($ip)) {
|
||||
if (!empty($ip) && !check_ip($ip)) {
|
||||
$errors[] = $this->messages['ip'][0];
|
||||
}
|
||||
}
|
||||
|
||||
for ($i = 0; $i < sizeof($this->attributes['dhcpStatements']); $i++) {
|
||||
if (substr($this->attributes['dhcpStatements'][$i], 0, 5) == 'zone ') {
|
||||
|
|
|
@ -370,11 +370,11 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
|||
*/
|
||||
public function save_attributes() {
|
||||
// remove dhcpSubnet object class if only the DHCP settings were changed
|
||||
if ($this->isRootNode()) {
|
||||
if (!in_array_ignore_case("dhcpSubnet", $this->orig['objectClass']) && in_array_ignore_case("dhcpSubnet", $this->attributes['objectClass'])) {
|
||||
if ($this->isRootNode()
|
||||
&& !in_array_ignore_case("dhcpSubnet", $this->orig['objectClass'])
|
||||
&& in_array_ignore_case("dhcpSubnet", $this->attributes['objectClass'])) {
|
||||
$this->attributes['objectClass'] = array_delete(array("dhcpSubnet"), $this->attributes['objectClass']);
|
||||
}
|
||||
}
|
||||
return parent::save_attributes();
|
||||
}
|
||||
|
||||
|
@ -386,11 +386,11 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
|||
*/
|
||||
public function process_attributes() {
|
||||
// check if DHCP main settings and valid DHCP entry
|
||||
if ($this->isRootNode()) {
|
||||
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||
if ($this->isRootNode()
|
||||
&& !in_array_ignore_case('dhcpService', $this->attributes['objectClass'])
|
||||
&& !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
$errors = array();
|
||||
|
||||
// Check if cn is not empty
|
||||
|
@ -420,11 +420,9 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
|||
|
||||
// Check domainname:
|
||||
if (!empty($_POST['domainname'])) $_POST['domainname'] = trim($_POST['domainname']);
|
||||
if (!empty($_POST['domainname'])) {
|
||||
if (!preg_match("/^[A-Za-z0-9\\._-]*$/", $_POST['domainname'])) {
|
||||
if (!empty($_POST['domainname']) && !preg_match("/^[A-Za-z0-9\\._-]*$/", $_POST['domainname'])) {
|
||||
$errors[] = $this->messages['domainname'][2];
|
||||
}
|
||||
}
|
||||
$this->setDHCPOption('domain-name', '"' . $_POST['domainname'] . '"');
|
||||
|
||||
// Check DNS
|
||||
|
@ -562,12 +560,12 @@ By default, the nodes are configured as H-Nodes which fits for small networks. I
|
|||
public function display_html_attributes() {
|
||||
$return = new htmlResponsiveRow();
|
||||
// check if DHCP main settings and valid DHCP entry
|
||||
if ($this->isRootNode()) {
|
||||
if (!in_array_ignore_case('dhcpService', $this->attributes['objectClass']) && !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||
if ($this->isRootNode()
|
||||
&& !in_array_ignore_case('dhcpService', $this->attributes['objectClass'])
|
||||
&& !in_array_ignore_case('dhcpServer', $this->attributes['objectClass'])) {
|
||||
$return->add(new htmlStatusMessage('ERROR', _('Please set your LDAP suffix to an LDAP entry with object class "dhcpService" or "dhcpServer".')), 12);
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
// Subnet name
|
||||
if (!$this->isRootNode()) {
|
||||
$cn = '';
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
|
||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||
Copyright (C) 2009 - 2019 Roland Gruber
|
||||
Copyright (C) 2009 - 2020 Roland Gruber
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -398,11 +398,9 @@ class eduPerson extends baseModule {
|
|||
$this->attributes['eduPersonScopedAffiliation'] = array_values(array_unique($this->attributes['eduPersonScopedAffiliation']));
|
||||
// principal name
|
||||
$this->attributes['eduPersonPrincipalName'][0] = $_POST['eduPersonPrincipalName'];
|
||||
if ($_POST['eduPersonPrincipalName'] != '') {
|
||||
if (!preg_match('/^[0-9a-z_\\.@-]+$/i', $_POST['eduPersonPrincipalName'])) {
|
||||
if (($_POST['eduPersonPrincipalName'] != '') && !preg_match('/^[0-9a-z_\\.@-]+$/i', $_POST['eduPersonPrincipalName'])) {
|
||||
$errors[] = $this->messages['eduPersonPrincipalName'][0];
|
||||
}
|
||||
}
|
||||
// affiliations
|
||||
$this->attributes['eduPersonAffiliation'] = array();
|
||||
$i = 0;
|
||||
|
@ -422,18 +420,14 @@ class eduPerson extends baseModule {
|
|||
$this->processMultiValueInputTextField('eduPersonEntitlement', $errors);
|
||||
// org DN
|
||||
$this->attributes['eduPersonOrgDN'][0] = $_POST['eduPersonOrgDN'];
|
||||
if ($_POST['eduPersonOrgDN'] != '') {
|
||||
if (!get_preg($_POST['eduPersonOrgDN'], 'dn')) {
|
||||
if (($_POST['eduPersonOrgDN'] != '') && !get_preg($_POST['eduPersonOrgDN'], 'dn')) {
|
||||
$errors[] = $this->messages['eduPersonOrgDN'][0];
|
||||
}
|
||||
}
|
||||
// primary OU
|
||||
$this->attributes['eduPersonPrimaryOrgUnitDN'][0] = $_POST['eduPersonPrimaryOrgUnitDN'];
|
||||
if ($_POST['eduPersonPrimaryOrgUnitDN'] != '') {
|
||||
if (!get_preg($_POST['eduPersonPrimaryOrgUnitDN'], 'dn')) {
|
||||
if (($_POST['eduPersonPrimaryOrgUnitDN'] != '') && !get_preg($_POST['eduPersonPrimaryOrgUnitDN'], 'dn')) {
|
||||
$errors[] = $this->messages['eduPersonPrimaryOrgUnitDN'][0];
|
||||
}
|
||||
}
|
||||
// OUs
|
||||
$this->processMultiValueInputTextField('eduPersonOrgUnitDN', $errors, 'dn');
|
||||
// assurance profiles
|
||||
|
@ -449,12 +443,12 @@ class eduPerson extends baseModule {
|
|||
function load_profile($profile) {
|
||||
parent::load_profile($profile);
|
||||
// add extension
|
||||
if (isset($profile['eduPerson_addExt'][0]) && ($profile['eduPerson_addExt'][0] == "true")) {
|
||||
if (!in_array('eduPerson', $this->attributes['objectClass'])) {
|
||||
if (isset($profile['eduPerson_addExt'][0])
|
||||
&& ($profile['eduPerson_addExt'][0] == "true")
|
||||
&& !in_array('eduPerson', $this->attributes['objectClass'])) {
|
||||
$this->attributes['objectClass'][] = 'eduPerson';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
|
|
@ -711,8 +711,9 @@ class freeRadius extends baseModule {
|
|||
function check_profileOptions($options, $typeId) {
|
||||
$messages = parent::check_profileOptions($options, $typeId);
|
||||
// group names
|
||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')) {
|
||||
if (isset($options['freeRadius_radiusGroupName'][0]) && ($options['freeRadius_radiusGroupName'][0] != '')) {
|
||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')
|
||||
&& isset($options['freeRadius_radiusGroupName'][0])
|
||||
&& ($options['freeRadius_radiusGroupName'][0] != '')) {
|
||||
$list = preg_split('/;[ ]*/', $options['freeRadius_radiusGroupName'][0]);
|
||||
for ($i = 0; $i < sizeof($list); $i++) {
|
||||
if (!get_preg($list[$i], 'groupname')) {
|
||||
|
@ -721,7 +722,6 @@ class freeRadius extends baseModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $messages;
|
||||
}
|
||||
|
||||
|
@ -733,13 +733,13 @@ class freeRadius extends baseModule {
|
|||
function load_profile($profile) {
|
||||
// profile mappings in meta data
|
||||
parent::load_profile($profile);
|
||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')) {
|
||||
// group names
|
||||
if (isset($profile['freeRadius_radiusGroupName'][0]) && $profile['freeRadius_radiusGroupName'][0] != '') {
|
||||
if (!$this->isBooleanConfigOptionSet('freeRadius_hideRadiusGroupName')
|
||||
&& isset($profile['freeRadius_radiusGroupName'][0])
|
||||
&& ($profile['freeRadius_radiusGroupName'][0] != '')) {
|
||||
$this->attributes['radiusGroupName'] = preg_split('/;[ ]*/', $profile['freeRadius_radiusGroupName'][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the expiration date attribute.
|
||||
|
|
Loading…
Reference in New Issue