26 require_once(
"../class/config.php");
28 if (!$admin->enabled) {
29 $msg->raise(
"ERROR",
"admin", _(
"This page is restricted to authorized staff"));
30 echo
$msg->msg_html_all();
35 "edit" => array (
"request",
"string",
""),
36 "doedit" => array (
"post",
"string",
""),
37 "minsize" => array (
"post",
"integer",
"0"),
38 "maxsize" => array (
"post",
"integer",
"64"),
39 "classcount" => array (
"post",
"integer",
"0"),
40 "allowlogin" => array (
"post",
"integer",
"0"),
46 include_once(
"head.php");
49 <h3><?php
__(
"Manage Password Policy"); ?></h3>
53 $c=$admin->listPasswordPolicies();
55 if (isset($doedit) && $doedit) {
57 $msg->raise(
"ERROR",
"admin", _(
"Policy not found"));
60 if ($admin->editPolicy($doedit,$minsize,$maxsize,$classcount,$allowlogin)) {
61 $msg->raise(
"INFO",
"admin", _(
"Policy changed"));
63 $c=$admin->listPasswordPolicies();
65 $msg->raise(
"ERROR",
"admin", _(
"Cannot edit the policy, an error occurred"));
69 echo
$msg->msg_html_all(
true,
true);
73 $msg->raise(
"ERROR",
"admin", _(
"Policy not found"));
74 echo
$msg->msg_html_all();
78 <p><?php
__(
"Please choose which policy you want to apply to this password kind:"); ?></p>
80 <p><b><?php echo
$c[$edit][
"description"]; ?></b></p>
82 <form method=
"post" action=
"adm_passpolicy.php">
84 <input type=
"hidden" name=
"doedit" value=
"<?php ehe($edit); ?>"/>
87 <th><?php
__(
"Minimum Password Size:"); ?></th>
88 <td><select
class=
"inl" name=
"minsize" id=
"minsize"><?php
for(
$i=0;
$i<=64;
$i++) {
90 if (
$c[$edit][
"minsize"]==
$i) echo
" selected=\"selected\"";
94 <tr><th><?php
__(
"Maximum Password Size:"); ?></th>
95 <td><select
class=
"inl" name=
"maxsize" id=
"maxsize"><?php
for(
$i=0;
$i<=64;
$i++) {
97 if (
$c[$edit][
"maxsize"]==
$i) echo
" selected=\"selected\"";
101 <tr> <th><?php
__(
"In how many classes of characters must be the password (at least):"); ?></th>
102 <td><select
class=
"inl" name=
"classcount" id=
"classcount"><?php
for(
$i=0;
$i<=4;
$i++) {
104 if (
$c[$edit][
"classcount"]==
$i) echo
" selected=\"selected\"";
108 <tr> <th><?php
__(
"Do we allow the password to be like the login?"); ?></th>
110 <input type=
"radio" name=
"allowlogin" id=
"allowlogin0" value=
"0" <?php
cbox(!
$c[$edit][
"allowlogin"]); ?> /> <?php
__(
"No"); ?>
111 <input type=
"radio" name=
"allowlogin" id=
"allowlogin1" value=
"1" <?php
cbox(
$c[$edit][
"allowlogin"]); ?> /> <?php
__(
"Yes"); ?>
114 <p><input type=
"submit" class=
"inb ok" name=
"go" value=
"<?php __("Apply
this password policy
"); ?>" />
115 <input type=
"button" class=
"inb cancel" name=
"cancel" value=
"<?php __("Cancel and go back to the policy list
"); ?>" onclick=
"document.location='adm_passpolicy.php'" /></p>
118 <p><?php
__(
"The classes of characters are : <br />1. Low-case letters (a-z)<br />2. Upper-case letters (A-Z)<br />3. Figures (0-9)<br />4. Ascii symbols (!\"#$%&'()*+,-./:;<=>?@[\\]^_`)<br />5. Non-Ascii symbols (accents...)"); ?></p>
122 require_once(
"foot.php");
131 <?php
__(
"Here is the list of the password policies for each place a password may be needed in AlternC's services. For each of those password kind, you can choose which policy will be applied to passwords. A policy is a minimum and maximum password size, and how many classes of characters must appear in the password. You can also forbid (or not) to use the login or part of it as a password."); ?>
134 <table
class=
"tlist">
135 <tr><th rowspan=
"2"> </th><th rowspan=
"2"><?php
__(
"Password Kind"); ?></th><th colspan=
"4"><?php
__(
"Password Policy"); ?></th></tr>
137 <th><?php
__(
"Min Size"); ?></th>
138 <th><?php
__(
"Max Size"); ?></th>
139 <th><?php
__(
"Complexity"); ?></th>
140 <th><?php
__(
"Allow Password=Login?"); ?></th>
148 <div
class=
"ina edit"><a href=
"adm_passpolicy.php?edit=<?php echo urlencode($v["name
"]); ?>"><?php
__(
"Edit"); ?></a></div>
150 <td><?php echo $v[
"description"]; ?></td>
151 <td
class=
"center"><?php echo $v[
"minsize"]; ?></td>
152 <td
class=
"center"><?php echo $v[
"maxsize"]; ?></td>
153 <td
class=
"center"><?php echo $v[
"classcount"]; ?></td>
154 <td
class=
"center"><?php
if ($v[
"allowlogin"])
__(
"Yes");
else __(
"No"); ?></td>
163 <?php include_once(
"foot.php"); ?>
if(! $admin->enabled) $fields
Manages password policy for misc.
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
csrf_get($return=false)
Give a new CSRF uniq token for a form the session must be up since the CSRF is linked to the session ...