Project

General

Profile

« Previous | Next » 

Revision 1bb9c407

Added by Marcos M about 1 year ago

Use config accessors in users and groups functions

View differences:

src/etc/phpshellsessions/changepassword
44 44
$username = trim($username);
45 45

  
46 46
// If the user does not exist, bail
47
$user =& getUserEntry($username);
47
$user_item_config = getUserEntry($username);
48
$user = &$user_item_config['item'];
48 49
if ($user == NULL) {
49 50
	printf(gettext("User '%s' does not exist.\n"), $username);
50 51
	exit(-1);
......
75 76
	echo gettext("Account is disabled, would you like to re-enable? [y|n]") . ": ";
76 77
	if (strcasecmp(chop(fgets($fp)), "y") == 0) {
77 78
		unset($user['disabled']);
79
		if (isset($user_item_config['idx'])) {
80
			config_del_path("system/user/{$user_item_config['idx']}/disabled");
81
		}
78 82
	}
79 83
}
80 84
// Check if user is expired
......
82 86
	echo gettext("Account is expired, would you like to clear the expiration date? [y|n]") . ": ";
83 87
	if (strcasecmp(chop(fgets($fp)), "y") == 0) {
84 88
		unset($user['expires']);
89
		if (isset($user_item_config['idx'])) {
90
			config_del_path("system/user/{$user_item_config['idx']}/expires");
91
		}
85 92
	}
86 93
}
87 94

  
......
90 97
// Compare password and confirm
91 98
if ($password == $confpassword) {
92 99
	//Reset password
93
	local_user_set_password($user, $password);
100
	local_user_set_password($user_item_config, $password);
94 101
	local_user_set($user);
95 102
	write_config(sprintf(gettext("password changed for user '%s' from console."), $username));
96 103
	exit(0);

Also available in: Unified diff