Alternc  latest
Alternc logiel libre pour l'hébergement
aws_pass.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  AlternC - Web Hosting System
5  Copyright (C) 2000-2012 by the AlternC Development Team.
6  https://alternc.org/
7  ----------------------------------------------------------------------
8  LICENSE
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License (GPL)
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  To read the license please visit http://www.gnu.org/copyleft/gpl.html
21  ----------------------------------------------------------------------
22  Purpose of file: Change a user's password.
23  ----------------------------------------------------------------------
24 */
25 require_once("../class/config.php");
26 
27 $fields = array (
28  "login" => array ("request", "string", ""),
29  "pass" => array ("post", "string", ""),
30  "passconf" => array ("post", "string", ""),
31  "confirm" => array ("post", "string", ""),
32 );
33 
35 
36 if (!$aws->login_exists($login)) {
37  include("aws_users.php");
38  exit();
39 }
40 
41 if ($confirm == 1) {
42  if (empty($pass) || is_null($pass)) {
43  $msg->raise('Error', "aws", _("Please enter a password"));
44  } else if ($pass != $passconf) {
45  $msg->raise('Error', "aws", _("Passwords do not match"));
46  } else {
47  if ($aws->change_pass($login,$pass)) {
48  $msg->raise('INFO', "aws", _("Password successfuly updated"));
49  include("aws_users.php");
50  exit();
51  }
52  }
53 }
54 
55 include_once("head.php");
56 
57 $c=$admin->listPasswordPolicies();
58 $passwd_classcount = $c['aws']['classcount'];
59 
60 ?>
61 <h3><?php __("Change a user's password"); ?></h3>
62 <?php
63 echo $msg->msg_html_all();
64 ?>
65 
66 <form method="post" action="aws_pass.php" name="main" id="main">
67 <?php csrf_get(); ?>
68 <input type="hidden" name="confirm" value="1" />
69 <table class="tedit">
70 <tr><th>
71 <?php __("Username"); ?></th><td>
72  <code><?php echo $login; ?></code> <input type="hidden" name="login" value="<?php echo $login; ?>" />
73 </td></tr>
74 <tr><th><label for="pass"><?php __("New Password"); ?></label></th><td><input type="password" class="int" name="pass" id="pass" value="<?php echo $pass; ?>" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#pass","#passconf",$passwd_classcount); ?></td></tr>
75 <tr><th><label for="passconf"><?php __("Confirm password"); ?></label></th><td><input type="password" class="int" name="passconf" id="passconf" value="" size="20" maxlength="64" /></td></tr>
76 <tr class="trbtn"><td colspan="2">
77  <input type="submit" class="inb" name="submit" value="<?php __("Change this user's password"); ?>" />
78  <input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='aws_users.php'"/>
79 </td></tr>
80 </table>
81 </form>
82 
83 <script type="text/javascript">
84 document.forms['main'].pass.focus();
85 document.forms['main'].setAttribute('autocomplete', 'off');
86 </script>
87 
88 
89 <?php include_once("foot.php"); ?>
exit
Definition: adm_doadd.php:70
$msg
Definition: bootstrap.php:75
$fields
Definition: aws_pass.php:27
$c
Definition: aws_pass.php:57
$passwd_classcount
Definition: aws_pass.php:58
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
$login