moved password fields to subpage (task #114875)
This commit is contained in:
		
							parent
							
								
									b8a99ec1e3
								
							
						
					
					
						commit
						7260a8c409
					
				|  | @ -319,7 +319,10 @@ class posixAccount extends baseModule { | ||||||
| 					"Headline" => _("Home directory"), | 					"Headline" => _("Home directory"), | ||||||
| 					"Text" => _('$user and $group are replaced with username or primary groupname.') | 					"Text" => _('$user and $group are replaced with username or primary groupname.') | ||||||
| 				), | 				), | ||||||
| 				/*'userPassword'		=>*/ | 				'userPassword' => array( | ||||||
|  | 					"Headline" => _("Password"), | ||||||
|  | 					"Text" => _("Please enter the password which you want to set for this account.") | ||||||
|  | 				), | ||||||
| 				'userPassword_no' => array( | 				'userPassword_no' => array( | ||||||
| 					"Headline" => _("Use no password"), | 					"Headline" => _("Use no password"), | ||||||
| 					"Text" => _("If checked no password will be used.") | 					"Text" => _("If checked no password will be used.") | ||||||
|  | @ -688,7 +691,7 @@ class posixAccount extends baseModule { | ||||||
| 				else { | 				else { | ||||||
| 					$this->userPassword_invalid=false; | 					$this->userPassword_invalid=false; | ||||||
| 					if ($post['genpass']) $this->userPassword(genpasswd()); | 					if ($post['genpass']) $this->userPassword(genpasswd()); | ||||||
| 					else { | 					elseif ($_SESSION[$this->base]->isNewAccount) { | ||||||
| 						if ($post['userPassword'] != $post['userPassword2']) | 						if ($post['userPassword'] != $post['userPassword2']) | ||||||
| 							$triggered_messages['userPassword'][] = $this->messages['userPassword'][0]; | 							$triggered_messages['userPassword'][] = $this->messages['userPassword'][0]; | ||||||
| 						else $this->userPassword($post['userPassword']); | 						else $this->userPassword($post['userPassword']); | ||||||
|  | @ -759,7 +762,7 @@ class posixAccount extends baseModule { | ||||||
| 			if ($_SESSION[$this->base]->type=='host') | 			if ($_SESSION[$this->base]->type=='host') | ||||||
| 				$triggered_messages['uid'][] = $this->messages['uid'][6]; | 				$triggered_messages['uid'][] = $this->messages['uid'][6]; | ||||||
| 			} | 			} | ||||||
| 			if (!get_preg($this->userPassword(), 'password')) | 			if ($_SESSION[$this->base]->isNewAccount && !get_preg($this->userPassword(), 'password')) | ||||||
| 			$triggered_messages['userPassword'][] = $this->messages['userPassword'][1]; | 			$triggered_messages['userPassword'][] = $this->messages['userPassword'][1]; | ||||||
| 		} | 		} | ||||||
| 	 | 	 | ||||||
|  | @ -774,6 +777,7 @@ class posixAccount extends baseModule { | ||||||
| 	else $this->triggered_messages = array(); | 	else $this->triggered_messages = array(); | ||||||
| 	// Go to additional group page when no error did ocour and button was pressed
 | 	// Go to additional group page when no error did ocour and button was pressed
 | ||||||
| 	if ($post['addgroup'])  return 'group'; | 	if ($post['addgroup'])  return 'group'; | ||||||
|  | 	if ($post['changepass'])  return 'password'; | ||||||
| 	return 0; | 	return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -798,6 +802,24 @@ class posixAccount extends baseModule { | ||||||
| 	return 0; | 	return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	* Sets a new password. | ||||||
|  | 	* | ||||||
|  | 	* @param $post HTTP POST | ||||||
|  | 	*/ | ||||||
|  | 	function process_password(&$post) { | ||||||
|  | 		if ($post['back']) return 'attributes'; | ||||||
|  | 		$messages = array(); | ||||||
|  | 		if ($post['userPassword'] != $post['userPassword2']) { | ||||||
|  | 			$messages['userPassword'][] = $this->messages['userPassword'][0]; | ||||||
|  | 			if (!get_preg($post['userPassword'], 'password')) | ||||||
|  | 				$messages['userPassword'][] = $this->messages['userPassword'][1]; | ||||||
|  | 			} | ||||||
|  | 			else $this->userPassword($post['userPassword']); | ||||||
|  | 		if (sizeof($messages) > 0) return $messages; | ||||||
|  | 		else return 'attributes'; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	/* This function will create the html-page | 	/* This function will create the html-page | ||||||
| 	* to show a page with all attributes. | 	* to show a page with all attributes. | ||||||
| 	* It will output a complete html-table | 	* It will output a complete html-table | ||||||
|  | @ -810,56 +832,77 @@ class posixAccount extends baseModule { | ||||||
| 		} | 		} | ||||||
| 		$shelllist = getshells(); // list of all valid shells
 | 		$shelllist = getshells(); // list of all valid shells
 | ||||||
| 
 | 
 | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Username").'*' ), | 		$return[] = array ( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'uid', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['uid'][0]), | 			0 => array('kind' => 'text', 'text' => _("Username").'*'), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'uid')); | 			1 => array('kind' => 'input', 'name' => 'uid', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['uid'][0]), | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('UID number').'*' ), | 			2 => array('kind' => 'help', 'value' => 'uid')); | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'uidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['uidNumber'][0]), | 		$return[] = array( | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'uidNumber')); | 			0 => array('kind' => 'text', 'text' => _('UID number').'*'), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'uidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['uidNumber'][0]), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'uidNumber')); | ||||||
| 		if (!isset($_SESSION[$this->base]->modules['inetOrgPerson'])) { | 		if (!isset($_SESSION[$this->base]->modules['inetOrgPerson'])) { | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Gecos') ), | 			$return[] = array( | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'gecos', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['gecos'][0]), | 				0 => array('kind' => 'text', 'text' => _('Gecos')), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'gecos')); | 				1 => array('kind' => 'input', 'name' => 'gecos', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['gecos'][0]), | ||||||
|  | 				2 => array('kind' => 'help', 'value' => 'gecos')); | ||||||
| 		} | 		} | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Primary group').'*' ), | 		$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' => | 			0 => array('kind' => 'text', 'text' => _('Primary group').'*' ), | ||||||
| 		array ($_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]))), | 			1 => array('kind' => 'select', 'name' => 'gidNumber', 'options' => $groups, 'options_selected' => array($_SESSION['cache']->getgrnam($this->attributes['gidNumber'][0]))), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'gidNumber')); | 			2 => array('kind' => 'help', 'value' => 'gidNumber')); | ||||||
| 
 | 
 | ||||||
| 		if ($_SESSION[$this->base]->type=='user') { | 		if ($_SESSION[$this->base]->type=='user') { | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Additional groups') ), | 			$return[] = array( | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'addgroup', 'type' => 'submit', 'value' => _('Edit groups')), | 				0 => array('kind' => 'text', 'text' => _('Additional groups')), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'addgroup')); | 				1 => array('kind' => 'input', 'name' => 'addgroup', 'type' => 'submit', 'value' => _('Edit groups')), | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Home directory').'*' ), | 				2 => array('kind' => 'help', 'value' => 'addgroup')); | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]), | 			$return[] = array( | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'homeDirectory')); | 				0 => array('kind' => 'text', 'text' => _('Home directory').'*'), | ||||||
|  | 				1 => array('kind' => 'input', 'name' => 'homeDirectory', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['homeDirectory'][0]), | ||||||
|  | 				2 => array('kind' => 'help', 'value' => 'homeDirectory')); | ||||||
| 			if ($this->orig['homeDirectory']=='' && isset($_SESSION['config']->scriptPath)) { | 			if ($this->orig['homeDirectory']=='' && isset($_SESSION['config']->scriptPath)) { | ||||||
| 				$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Create home directory') ), | 				$return[] = array( | ||||||
| 				1 => array ( 'kind' => 'input', 'name' => 'createhomedir', 'type' => 'checkbox', 'checked' => $this->createhomedir), | 					0 => array('kind' => 'text', 'text' => _('Create home directory')), | ||||||
| 				2 => array ('kind' => 'help', 'value' => 'createhomedir')); | 					1 => array('kind' => 'input', 'name' => 'createhomedir', 'type' => 'checkbox', 'checked' => $this->createhomedir), | ||||||
|  | 					2 => array('kind' => 'help', 'value' => 'createhomedir')); | ||||||
| 				} | 				} | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Password') ), | 			if ($_SESSION[$this->base]->isNewAccount) { | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $this->userPassword()), | 				$return[] = array( | ||||||
| 			2 => array ( 'kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password'))); | 					0 => array('kind' => 'text', 'text' => _('Password') ), | ||||||
|  | 					1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $this->userPassword()), | ||||||
|  | 					2 => array('kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password'))); | ||||||
| 				if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | 				if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | ||||||
| 				else $password2 = $this->userPassword(); | 				else $password2 = $this->userPassword(); | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Repeat password') ), | 				$return[] = array( | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2), | 					0 => array('kind' => 'text', 'text' => _('Repeat password')), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'userPassword')); | 					1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2), | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Set no password') ), | 					2 => array('kind' => 'help', 'value' => 'userPassword')); | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'userPassword_nopassword', 'type' => 'checkbox', 'checked' => $this->userPassword_nopassword), | 			} | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'userPassword_nopassword')); | 			else { | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Invalid password') ), | 				$return[] = array( | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'userPassword_invalid', 'type' => 'checkbox', 'checked' => $this->userPassword_invalid), | 					0 => array('kind' => 'text', 'text' => _('Password') ), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'userPassword_invalid')); | 					1 => array('kind' => 'input', 'name' => 'changepass', 'type' => 'submit', 'value' => _('Change password'))); | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Lock password') ), | 			} | ||||||
| 			1 => array ( 'kind' => 'input', 'name' => 'userPassword_lock', 'type' => 'checkbox', 'checked' => $this->userPassword_lock), | 			$return[] = array( | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'userPassword_lock')); | 				0 => array('kind' => 'text', 'text' => _('Set no password')), | ||||||
| 			if (count($shelllist)!=0) | 				1 => array('kind' => 'input', 'name' => 'userPassword_nopassword', 'type' => 'checkbox', 'checked' => $this->userPassword_nopassword), | ||||||
| 			$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Login shell').'*' ), | 				2 => array('kind' => 'help', 'value' => 'userPassword_nopassword')); | ||||||
| 			1 => array ( 'kind' => 'select', 'name' => 'loginShell', 'options' => $shelllist, 'options_selected' => | 			$return[] = array( | ||||||
| 			array ($this->attributes['loginShell'][0])), | 				0 => array('kind' => 'text', 'text' => _('Invalid password')), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'loginShell')); | 				1 => array('kind' => 'input', 'name' => 'userPassword_invalid', 'type' => 'checkbox', 'checked' => $this->userPassword_invalid), | ||||||
|  | 				2 => array('kind' => 'help', 'value' => 'userPassword_invalid')); | ||||||
|  | 			if ($_SESSION[$this->base]->isNewAccount || isset($this->attributes['userPassword'][0])) { | ||||||
|  | 				$return[] = array( | ||||||
|  | 					0 => array('kind' => 'text', 'text' => _('Lock password')), | ||||||
|  | 					1 => array('kind' => 'input', 'name' => 'userPassword_lock', 'type' => 'checkbox', 'checked' => $this->userPassword_lock), | ||||||
|  | 					2 => array('kind' => 'help', 'value' => 'userPassword_lock')); | ||||||
|  | 			} | ||||||
|  | 			if (count($shelllist)!=0) { | ||||||
|  | 				$return[] = array( | ||||||
|  | 					0 => array('kind' => 'text', 'text' => _('Login shell').'*'), | ||||||
|  | 					1 => array('kind' => 'select', 'name' => 'loginShell', 'options' => $shelllist, 'options_selected' => array ($this->attributes['loginShell'][0])), | ||||||
|  | 					2 => array('kind' => 'help', 'value' => 'loginShell')); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	return $return; | 	return $return; | ||||||
| 	} | 	} | ||||||
|  | @ -921,6 +964,30 @@ class posixAccount extends baseModule { | ||||||
| 		return $return; | 		return $return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	* Displays the password changing dialog. | ||||||
|  | 	* | ||||||
|  | 	* @param array $post HTTP-POST | ||||||
|  | 	* @return array meta HTML code | ||||||
|  | 	*/ | ||||||
|  | 	function display_html_password(&$post) { | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Password') ), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'userPassword')); | ||||||
|  | 		if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | ||||||
|  | 		else $password2 = $this->userPassword(); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Repeat password')), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => "")); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'table', 'value' => array( | ||||||
|  | 				0 => array( | ||||||
|  | 					0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Submit'), 'name' => 'submit'), | ||||||
|  | 					1 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Back'), 'name' => 'back'), | ||||||
|  | 					2 => array('kind' => 'text'))))); | ||||||
|  | 		return $return; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	/** | 	/** | ||||||
| 	* Returns a list of elements for the account profiles. | 	* Returns a list of elements for the account profiles. | ||||||
|  |  | ||||||
|  | @ -136,39 +136,58 @@ class posixGroup extends baseModule { | ||||||
| 	* It will output a complete html-table | 	* It will output a complete html-table | ||||||
| 	*/ | 	*/ | ||||||
| 	function display_html_attributes(&$post) { | 	function display_html_attributes(&$post) { | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Groupname").'*' ), | 		$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['cn'][0]), | 			0 => array('kind' => 'text', 'text' => _("Groupname").'*'), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'cn')); | 			1 => array('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '20', 'maxlength' => '20', 'value' => $this->attributes['cn'][0]), | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('GID number').'*' ), | 			2 => array('kind' => 'help', 'value' => 'cn')); | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'gidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['gidNumber'][0]), | 		$return[] = array( | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'gidNumber')); | 			0 => array('kind' => 'text', 'text' => _('GID number').'*'), | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Description') ), | 			1 => array('kind' => 'input', 'name' => 'gidNumber', 'type' => 'text', 'size' => '6', 'maxlength' => '6', 'value' => $this->attributes['gidNumber'][0]), | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0]), | 			2 => array('kind' => 'help', 'value' => 'gidNumber')); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Description')), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0]), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'description')); | 			2 => array ('kind' => 'help', 'value' => 'description')); | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _("Group members").'*' ), | 		$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'adduser', 'type' => 'submit', 'value' => _('Edit members')), | 			0 => array('kind' => 'text', 'text' => _("Group members").'*'), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'adduser', 'type' => 'submit', 'value' => _('Edit members')), | ||||||
| 			2 => array ('kind' => 'help', 'value' => 'adduser')); | 			2 => array ('kind' => 'help', 'value' => 'adduser')); | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Password') ), | 		if ($_SESSION[$this->base]->isNewAccount) { | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $this->userPassword()), | 			$return[] = array( | ||||||
| 		2 => array ( 'kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password'))); | 				0 => array('kind' => 'text', 'text' => _('Password')), | ||||||
|  | 				1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $this->userPassword()), | ||||||
|  | 				2 => array('kind' => 'input', 'name' => 'genpass', 'type' => 'submit', 'value' => _('Generate password'))); | ||||||
| 			if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | 			if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | ||||||
| 			else $password2 = $this->userPassword(); | 			else $password2 = $this->userPassword(); | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Repeat password') ), | 			$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2), | 				0 => array('kind' => 'text', 'text' => _('Repeat password')), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'userPassword')); | 				1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => $password2), | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Set no password') ), | 				2 => array('kind' => 'help', 'value' => 'userPassword')); | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'userPassword_nopassword', 'type' => 'checkbox', 'checked' => $this->userPassword_nopassword), | 		} | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'userPassword_nopassword')); | 		else { | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Invalid password') ), | 			$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'userPassword_invalid', 'type' => 'checkbox', 'checked' => $this->userPassword_invalid), | 				0 => array('kind' => 'text', 'text' => _('Password') ), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'userPassword_invalid')); | 				1 => array('kind' => 'input', 'name' => 'changepass', 'type' => 'submit', 'value' => _('Change password'))); | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Lock password') ), | 		} | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'userPassword_lock', 'type' => 'checkbox', 'checked' => $this->userPassword_lock), | 		$return[] = array( | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'userPassword_lock')); | 			0 => array('kind' => 'text', 'text' => _('Set no password')), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword_nopassword', 'type' => 'checkbox', 'checked' => $this->userPassword_nopassword), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'userPassword_nopassword')); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Invalid password')), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword_invalid', 'type' => 'checkbox', 'checked' => $this->userPassword_invalid), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'userPassword_invalid')); | ||||||
|  | 		if ($_SESSION[$this->base]->isNewAccount || isset($this->attributes['userPassword'][0])) { | ||||||
|  | 			$return[] = array( | ||||||
|  | 				0 => array('kind' => 'text', 'text' => _('Lock password')), | ||||||
|  | 				1 => array('kind' => 'input', 'name' => 'userPassword_lock', 'type' => 'checkbox', 'checked' => $this->userPassword_lock), | ||||||
|  | 				2 => array('kind' => 'help', 'value' => 'userPassword_lock')); | ||||||
|  | 		} | ||||||
| 		if ($this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0] && $this->orig['gidNumber'][0]!='') | 		if ($this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0] && $this->orig['gidNumber'][0]!='') | ||||||
| 		$return[] = array ( 0 => array ( 'kind' => 'text', 'text' => _('Change GID number of users and hosts') ), | 		$return[] = array( | ||||||
| 		1 => array ( 'kind' => 'input', 'name' => 'changegids', 'type' => 'checkbox', 'checked' => $this->changegids, 'value' => true), | 			0 => array('kind' => 'text', 'text' => _('Change GID number of users and hosts')), | ||||||
| 		2 => array ('kind' => 'help', 'value' => 'changegids')); | 			1 => array('kind' => 'input', 'name' => 'changegids', 'type' => 'checkbox', 'checked' => $this->changegids, 'value' => true), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'changegids')); | ||||||
| 		return $return; | 		return $return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -234,6 +253,30 @@ class posixGroup extends baseModule { | ||||||
| 		return $return; | 		return $return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	* Displays the password changing dialog. | ||||||
|  | 	* | ||||||
|  | 	* @param array $post HTTP-POST | ||||||
|  | 	* @return array meta HTML code | ||||||
|  | 	*/ | ||||||
|  | 	function display_html_password(&$post) { | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Password') ), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => ""), | ||||||
|  | 			2 => array('kind' => 'help', 'value' => 'password')); | ||||||
|  | 		if ($post['userPassword2']!='') $password2 = $post['userPassword2']; | ||||||
|  | 		else $password2 = $this->userPassword(); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'text', 'text' => _('Repeat password')), | ||||||
|  | 			1 => array('kind' => 'input', 'name' => 'userPassword2', 'type' => 'password', 'size' => '20', 'maxlength' => '255', 'value' => "")); | ||||||
|  | 		$return[] = array( | ||||||
|  | 			0 => array('kind' => 'table', 'value' => array( | ||||||
|  | 				0 => array( | ||||||
|  | 					0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Submit'), 'name' => 'submit'), | ||||||
|  | 					1 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Back'), 'name' => 'back'), | ||||||
|  | 					2 => array('kind' => 'text'))))); | ||||||
|  | 		return $return; | ||||||
|  | 	} | ||||||
| 	 | 	 | ||||||
| 	/** | 	/** | ||||||
| 	* Returns meta data that is interpreted by parent class | 	* Returns meta data that is interpreted by parent class | ||||||
|  | @ -497,7 +540,7 @@ class posixGroup extends baseModule { | ||||||
| 				else { | 				else { | ||||||
| 					$this->userPassword_invalid=false; | 					$this->userPassword_invalid=false; | ||||||
| 					if ($post['genpass']) $this->userPassword(genpasswd()); | 					if ($post['genpass']) $this->userPassword(genpasswd()); | ||||||
| 					else { | 					elseif ($_SESSION[$this->base]->isNewAccount) { | ||||||
| 						if ($post['userPassword'] != $post['userPassword2']) | 						if ($post['userPassword'] != $post['userPassword2']) | ||||||
| 							$triggered_messages['userPassword'][] = $this->messages['userPassword'][0]; | 							$triggered_messages['userPassword'][] = $this->messages['userPassword'][0]; | ||||||
| 						else $this->userPassword($post['userPassword']); | 						else $this->userPassword($post['userPassword']); | ||||||
|  | @ -613,6 +656,7 @@ class posixGroup extends baseModule { | ||||||
| 		else $this->triggered_messages = array(); | 		else $this->triggered_messages = array(); | ||||||
| 		// Go to additional group page when no error did ocour and button was pressed
 | 		// Go to additional group page when no error did ocour and button was pressed
 | ||||||
| 		if ($post['adduser'])  return 'user'; | 		if ($post['adduser'])  return 'user'; | ||||||
|  | 		if ($post['changepass'])  return 'password'; | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -643,6 +687,24 @@ class posixGroup extends baseModule { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | 	/** | ||||||
|  | 	* Sets a new password. | ||||||
|  | 	* | ||||||
|  | 	* @param $post HTTP POST | ||||||
|  | 	*/ | ||||||
|  | 	function process_password(&$post) { | ||||||
|  | 		if ($post['back']) return 'attributes'; | ||||||
|  | 		$messages = array(); | ||||||
|  | 		if ($post['userPassword'] != $post['userPassword2']) { | ||||||
|  | 			$messages['userPassword'][] = $this->messages['userPassword'][0]; | ||||||
|  | 			if (!get_preg($post['userPassword'], 'password')) | ||||||
|  | 				$messages['userPassword'][] = $this->messages['userPassword'][1]; | ||||||
|  | 			} | ||||||
|  | 			else $this->userPassword($post['userPassword']); | ||||||
|  | 		if (sizeof($messages) > 0) return $messages; | ||||||
|  | 		else return 'attributes'; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
| 	/* This function returns an array with 3 entries: | 	/* This function returns an array with 3 entries: | ||||||
| 	* array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) | 	* array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... ) | ||||||
| 	* DN is the DN to change. It may be possible to change several DNs, | 	* DN is the DN to change. It may be possible to change several DNs, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue