Alternc  latest
Alternc logiel libre pour l'hébergement
adm_mxaccount.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Manage the list of allowed accounts to operate as secondary MX
22  * those account are allowed to list the hosted domains
23  * to configure their postfix as a secondary MX
24  *
25  * @copyright AlternC-Team 2000-2017 https://alternc.com/
26  */
27 
28 require_once("../class/config.php");
29 
30 if (!$admin->enabled) {
31  $msg->raise("ERROR", "admin", _("This page is restricted to authorized staff"));
32  echo $msg->msg_html_all();
33  exit();
34 }
35 
36 $fields = array (
37  "delaccount" => array ("request", "string", ""),
38  "newlogin" => array ("post", "string", ""),
39  "newpass" => array ("post", "string", ""),
40 );
42 
43 if ($delaccount) {
44  // Delete an account
45  if ($mail->del_slave_account($delaccount)) {
46  $msg->raise("INFO", "admin", _("The requested account has been deleted. It is now denied."));
47  }
48 }
49 if ($newlogin) {
50  // Add an account
51  if ($mail->add_slave_account($newlogin,$newpass)) {
52  $msg->raise("INFO", "admin", _("The requested account address has been created. It is now allowed."));
53  $newlogin='';$newpass='';
54  }
55 }
56 
57 include_once("head.php");
58 
59 $c=$admin->listPasswordPolicies();
60 $passwd_classcount = $c['adm']['classcount'];
61 
62 ?>
63 <h3><?php __("Manage allowed accounts for secondary mx"); ?></h3>
64 <hr id="topbar"/>
65 <br />
66 <?php
67 $c=$mail->enum_slave_account();
68 
69 echo $msg->msg_html_all();
70 
71 if (is_array($c)) {
72 
73 ?>
74 <p>
75 <?php __("Here is the list of the allowed accounts for secondary mx management. You can configure the alternc-secondarymx package on your secondary mx server and give him the login/pass that will grant him access to your server's mx-hosted domain list. "); ?>
76 </p>
77 
78 <table border="0" cellpadding="4" cellspacing="0" class='tlist'>
79 <tr><th><?php __("Action"); ?></th><th><?php __("Login"); ?></th><th><?php __("Password"); ?></th></tr>
80 <?php
81 for($i=0;$i<count($c);$i++) { ?>
82 
83 <tr class="lst">
84 <td class="center"><div class="ina delete"><a href="adm_mxaccount.php?delaccount=<?php echo urlencode($c[$i]["login"]); ?>"><?php __("Delete"); ?></a></div></td>
85 <td><?php echo $c[$i]["login"]; ?></td>
86 <td><?php echo $c[$i]["pass"]; ?></td>
87 </tr>
88 <?php
89 }
90 ?>
91 </table>
92  <?php } ?>
93 <p><?php __("If you want to allow a new server to access your mx-hosted domain list, give him an account."); ?></p>
94 <form method="post" action="adm_mxaccount.php" name="main" id="main" autocomplete="off">
95  <?php csrf_get(); ?>
96 <!-- honeypot fields -->
97 <input type="text" style="display: none" id="fakeUsername" name="fakeUsername" value="" />
98 <input type="password" style="display: none" id="fakePassword" name="fakePassword" value="" />
99 
100 <table class="tedit">
101 <tr><th><label for="newlogin"><?php __("Login"); ?></label></th><th><label for="newpass"><?php __("Password"); ?></label></th></tr>
102 <tr>
103  <td><input type="text" class="int" value="<?php ehe($newlogin); ?>" id="newlogin" name="newlogin" maxlength="64" size="32" /><br/><br/></td>
104  <td><input type="password" class="int" autocomplete="off" value="<?php ehe($newpass); ?>" id="newpass" name="newpass" maxlength="64" size="32" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#newpass","",$passwd_classcount); ?></td>
105 </tr>
106 <tr class="trbtn"><td colspan="2">
107  <input type="submit" value="<?php __("Add this account to the allowed list"); ?>" class="inb" />
108  </td></tr>
109 </table>
110 
111 </form>
112 
113 <script type="text/javascript">
114 document.forms['main'].newlogin.focus();
115 </script>
116 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
if(! $admin->enabled) $fields
Manage the list of allowed accounts to operate as secondary MX those account are allowed to list the ...
$passwd_classcount
$msg
Definition: bootstrap.php:75
const DEFAULT_PASS_SIZE
Define constants from vars of /etc/alternc/local.sh The you can't choose where is the AlternC Panel.
Definition: config.php:81
display_div_generate_password($pass_size=DEFAULT_PASS_SIZE, $fields_to_fill1="", $fields_to_fill2="", $classcount=3)
Show a button to set a random password for a password field.
Definition: functions.php:922
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
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 ...
Definition: functions.php:1159
$i