5 include_once($path_to_root . "/includes/session.inc");
7 page(_("Change password"));
9 include_once($path_to_root . "/includes/date_functions.inc");
10 include_once($path_to_root . "/includes/ui.inc");
12 include_once($path_to_root . "/admin/db/users_db.inc");
14 $selected_id = $_SESSION["wa_current_user"]->username;
17 if (isset($_GET['UpdatedID']))
19 display_notification_centered(_("Your password has been updated."));
22 function can_process()
25 if (strlen($_POST['password']) < 4)
27 display_error( _("The password entered must be at least 4 characters long."));
28 set_focus('password');
32 if (strstr($_POST['password'], $_POST['user_id']) != false)
34 display_error( _("The password cannot contain the user login."));
35 set_focus('password');
39 if ($_POST['password'] != $_POST['passwordConfirm'])
41 display_error( _("The passwords entered are not the same."));
42 set_focus('password');
49 if (isset($_POST['UPDATE_ITEM']))
54 if (isset($selected_id))
56 if ($_POST['password'] != "")
57 update_user_password($_POST['user_id'], md5($_POST['password']));
60 meta_forward($_SERVER['PHP_SELF'], "UpdatedID=1");
67 start_table($table_style);
69 if (isset($selected_id))
71 //editing an existing User
73 $myrow = get_user($selected_id);
75 $_POST['user_id'] = $myrow["user_id"];
76 hidden('selected_id', $selected_id);
77 hidden('user_id', $_POST['user_id']);
79 label_row(_("User login:"), $_POST['user_id']);
82 $_POST['password'] = "";
83 $_POST['passwordConfirm'] = "";
86 label_cell(_("Password:"));
87 label_cell("<input type='password' name='password' size=22 maxlength=20 value='" . $_POST['password'] . "'>");
91 label_cell(_("Repeat password:"));
92 label_cell("<input type='password' name='passwordConfirm' size=22 maxlength=20 value='" . $_POST['passwordConfirm'] . "'>");
95 if (isset($selected_id))
97 table_section_title(_("Enter your new password in the fields."));
102 submit_add_or_update_center(!isset($selected_id));