Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
59f43c12
Commit
59f43c12
authored
Aug 01, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(auth) move voucher to hotplug
parent
3ff2a47a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
44 deletions
+43
-44
Voucher.php
src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php
+42
-0
system_authservers.php
src/www/system_authservers.php
+1
-44
No files found.
src/opnsense/mvc/app/library/OPNsense/Auth/Voucher.php
View file @
59f43c12
...
...
@@ -389,4 +389,46 @@ class Voucher implements IAuthConnector
}
return
false
;
}
/**
* retrieve configuration options
* @return array
*/
public
function
getConfigurationOptions
()
{
$fields
=
array
();
$fields
[
"simplePasswords"
]
=
array
();
$fields
[
"simplePasswords"
][
"name"
]
=
gettext
(
"Use simple passwords (less secure)"
);
$fields
[
"simplePasswords"
][
"type"
]
=
"checkbox"
;
$fields
[
"simplePasswords"
][
"help"
]
=
gettext
(
"Use simple (less secure) passwords, which are easier to read"
)
;
$fields
[
"simplePasswords"
][
"validate"
]
=
function
(
$value
)
{
return
array
();
};
$fields
[
"usernameLength"
]
=
array
();
$fields
[
"usernameLength"
][
"name"
]
=
gettext
(
"Username length"
);
$fields
[
"usernameLength"
][
"type"
]
=
"text"
;
$fields
[
"usernameLength"
][
"default"
]
=
null
;
$fields
[
"usernameLength"
][
"help"
]
=
gettext
(
"Specify alternative username length for generating vouchers"
);
$fields
[
"usernameLength"
][
"validate"
]
=
function
(
$value
)
{
if
(
!
empty
(
$value
)
&&
filter_var
(
$value
,
FILTER_SANITIZE_NUMBER_INT
)
!=
$value
)
{
return
array
(
gettext
(
"username length must be a number or empty for default."
));
}
else
{
return
array
();
}
};
$fields
[
"passwordLength"
]
=
array
();
$fields
[
"passwordLength"
][
"name"
]
=
gettext
(
"Password length"
);
$fields
[
"passwordLength"
][
"type"
]
=
"text"
;
$fields
[
"passwordLength"
][
"default"
]
=
null
;
$fields
[
"passwordLength"
][
"help"
]
=
gettext
(
"Specify alternative password length for generating vouchers"
);
$fields
[
"passwordLength"
][
"validate"
]
=
function
(
$value
)
{
if
(
!
empty
(
$value
)
&&
filter_var
(
$value
,
FILTER_SANITIZE_NUMBER_INT
)
!=
$value
)
{
return
array
(
gettext
(
"password length must be a number or empty for default."
));
}
else
{
return
array
();
}
};
return
$fields
;
}
}
src/www/system_authservers.php
View file @
59f43c12
...
...
@@ -110,10 +110,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if
(
empty
(
$pconfig
[
'radius_auth_port'
]))
{
$pconfig
[
'radius_auth_port'
]
=
1812
;
}
}
elseif
(
$pconfig
[
'type'
]
==
'voucher'
)
{
$pconfig
[
'simplePasswords'
]
=
$a_server
[
$id
][
'simplePasswords'
];
$pconfig
[
'usernameLength'
]
=
$a_server
[
$id
][
'usernameLength'
];
$pconfig
[
'passwordLength'
]
=
$a_server
[
$id
][
'passwordLength'
];
}
elseif
(
!
empty
(
$authCNFOptions
[
$pconfig
[
'type'
]]))
{
foreach
(
$authCNFOptions
[
$pconfig
[
'type'
]][
'additionalFields'
]
as
$fieldname
=>
$field
)
{
$pconfig
[
$fieldname
]
=
$a_server
[
$id
][
$fieldname
];
...
...
@@ -170,13 +166,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$reqdfields
[]
=
"radius_secret"
;
$reqdfieldsn
[]
=
gettext
(
"Shared Secret"
);
}
}
elseif
(
$pconfig
[
'type'
]
==
"voucher"
)
{
if
(
!
empty
(
$pconfig
[
'usernameLength'
])
&&
!
is_numeric
(
$pconfig
[
'usernameLength'
]))
{
$input_errors
[]
=
gettext
(
"username length must be a number or empty for default."
);
}
if
(
!
empty
(
$pconfig
[
'passwordLength'
])
&&
!
is_numeric
(
$pconfig
[
'passwordLength'
]))
{
$input_errors
[]
=
gettext
(
"password length must be a number or empty for default."
);
}
}
elseif
(
!
empty
(
$authCNFOptions
[
$pconfig
[
'type'
]]))
{
foreach
(
$authCNFOptions
[
$pconfig
[
'type'
]][
'additionalFields'
]
as
$fieldname
=>
$field
)
{
if
(
!
empty
(
$field
[
'validate'
]))
{
...
...
@@ -263,10 +252,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$server
[
'radius_auth_port'
]
=
$pconfig
[
'radius_auth_port'
];
unset
(
$server
[
'radius_acct_port'
]);
}
}
elseif
(
$server
[
'type'
]
==
"voucher"
)
{
$server
[
'simplePasswords'
]
=
!
empty
(
$pconfig
[
'simplePasswords'
]);
$server
[
'usernameLength'
]
=
$pconfig
[
'usernameLength'
];
$server
[
'passwordLength'
]
=
$pconfig
[
'passwordLength'
];
}
elseif
(
!
empty
(
$authCNFOptions
[
$server
[
'type'
]]))
{
foreach
(
$authCNFOptions
[
$server
[
'type'
]][
'additionalFields'
]
as
$fieldname
=>
$field
)
{
$server
[
$fieldname
]
=
$pconfig
[
$fieldname
];
...
...
@@ -674,34 +659,6 @@ endif; ?>
</div>
</td>
</tr>
<!-- Vouchers -->
<tr
class=
"auth_voucher auth_options hidden"
>
<td><a
id=
"help_for_voucher_simplepasswd"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Use simple passwords (less secure)"
);
?>
</td>
<td>
<input
name=
"simplePasswords"
type=
"checkbox"
value=
"yes"
<?=
!
empty
(
$pconfig
[
'simplePasswords'
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
/>
<div
class=
"hidden"
for=
"help_for_voucher_simplepasswd"
>
<br
/>
<?=
gettext
(
"Use simple (less secure) passwords, which are easier to read"
)
?>
</div>
</td>
</tr>
<tr
class=
"auth_voucher auth_options hidden"
>
<td><a
id=
"help_for_voucher_usernameLength"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Username length"
);
?>
</td>
<td>
<input
name=
"usernameLength"
type=
"text"
value=
"
<?=
$pconfig
[
'usernameLength'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_voucher_usernameLength"
>
<?=
gettext
(
"Specify alternative username length for generating vouchers"
)
?>
</div>
</td>
</tr>
<tr
class=
"auth_voucher auth_options hidden"
>
<td><a
id=
"help_for_voucher_passwordLength"
href=
"#"
class=
"showhelp"
><i
class=
"fa fa-info-circle"
></i></a>
<?=
gettext
(
"Password length"
);
?>
</td>
<td>
<input
name=
"passwordLength"
type=
"text"
value=
"
<?=
$pconfig
[
'passwordLength'
];
?>
"
/>
<div
class=
"hidden"
for=
"help_for_voucher_passwordLength"
>
<?=
gettext
(
"Specify alternative password length for generating vouchers"
)
?>
</div>
</td>
</tr>
<!-- pluggable options -->
<?php
foreach
(
$authCNFOptions
as
$typename
=>
$authtype
)
:
...
...
@@ -737,7 +694,7 @@ endif; ?>
</select>
<?php
elseif
(
$field
[
'type'
]
==
'checkbox'
)
:?>
<
input
name
=
"<?=
$fieldname
;?>"
type
=
"checkbox"
value
=
"
yes
"
<?=!
empty
(
$pconfig
[
$fieldname
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
/>
<
input
name
=
"<?=
$fieldname
;?>"
type
=
"checkbox"
value
=
"
1
"
<?=!
empty
(
$pconfig
[
$fieldname
])
?
"checked=
\"
checked
\"
"
:
""
;
?>
/>
<?php
endif
;
?>
<div
class=
"hidden"
for=
"help_for_field_
<?=
$typename
;
?>
_
<?=
$fieldname
;
?>
"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment