summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3427307)
raw | patch | inline | side by side (parent: 3427307)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 2 Jul 2010 07:07:36 +0000 (07:07 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 2 Jul 2010 07:07:36 +0000 (07:07 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18911 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/plugins/admin/users/class_userManagement.inc | patch | blob | history | |
gosa-core/plugins/admin/users/password.tpl | patch | blob | history |
diff --git a/gosa-core/plugins/admin/users/class_userManagement.inc b/gosa-core/plugins/admin/users/class_userManagement.inc
index 405e14976ce78bb2a3e4540e09ff7973c5bb9bb5..738e478a8fa06a70f9f940eaba7c80c2d5fe5eed 100644 (file)
protected $aclPlugin = "user";
protected $objectName = "user";
+ protected $proposal = "";
+ protected $proposalEnabled = FALSE;
+ protected $proposalSelected = FALSE;
+
function __construct($config,$ui)
{
$this->config = $config;
if(isset($_POST['abort_event_dialog'])) $action['action'] = "abortEventDialog";
if(isset($_POST['password_cancel'])){
$action['action'] = "passwordCancel";
- }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']))){
+ }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']) || isset($_POST['refreshProposal']))){
$action['action'] = "passwordQueue";
}
return($action);
}
+
+ function refreshProposal()
+ {
+ $this->proposal = passwordMethod::getPasswordProposal($this->config);
+ $this->proposalEnabled = (!empty($this->proposal));
+ }
+
+
function handlePasswordQueue()
{
// skip if nothing is to do
if(empty($this->dn) && !count($this->pwd_change_queue)) return;
+ // Refresh proposal if requested
+ if(isset($_POST['refreshProposal'])) $this->refreshProposal();
+ if(isset($_POST['proposalSelected'])) $this->proposalSelected = get_post('proposalSelected') == 1;
+
$smarty = get_smarty();
+ $smarty->assign("proposal" , $this->proposal);
+ $smarty->assign("proposalEnabled" , $this->proposalEnabled);
+ $smarty->assign("proposalSelected" , $this->proposalSelected);
// Get next entry from queue.
if(empty($this->dn) && count($this->pwd_change_queue)){
- $this->dn = array_pop($this->pwd_change_queue);
- set_object_info($this->dn);
- return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+
+ // Generate new proposal
+ $this->refreshProposal();
+ $this->proposalSelected = ($this->proposal != "");
+ $smarty->assign("proposal" , $this->proposal);
+ $smarty->assign("proposalEnabled" , $this->proposalEnabled);
+ $smarty->assign("proposalSelected" , $this->proposalSelected);
+
+ $this->dn = array_pop($this->pwd_change_queue);
+ set_object_info($this->dn);
+ return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+
+ // If we've just refreshed the proposal then do not check the password for validity.
+ if(isset($_POST['refreshProposal'])){
+ return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
}
// Check permissions
- $dn = $this->dn;
- $acl = $this->ui->get_permissions($dn, "users/password");
- $cacl= $this->ui->get_permissions($dn, "users/user");
- if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
- $message= array();
- if ($_POST['new_password'] != $_POST['repeated_password']){
- $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
- } else {
- if ($_POST['new_password'] == ""){
- $message[] = msgPool::required(_("New password"));
- }
- }
+ if(isset($_POST['password_finish'])){
- // Display errors
- if (count($message) != 0){
- msg_dialog::displayChecks($message);
- return($smarty->fetch(get_template_path('password.tpl', TRUE)));
- }
+ $dn = $this->dn;
+ $acl = $this->ui->get_permissions($dn, "users/password");
+ $cacl= $this->ui->get_permissions($dn, "users/user");
+ if (preg_match('/w/', $acl) || preg_match('/c/', $cacl)){
- // Change cassword
- if(isset($this->force_hash_type[$this->dn])){
- if(!change_password ($this->dn, $_POST['new_password'],0,$this->force_hash_type[$this->dn])){
- return($smarty->fetch(get_template_path('password.tpl', TRUE)));
- }
- }else{
- if(!change_password ($this->dn, $_POST['new_password'])){
- return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ // Get posted passwords
+ if($this->proposalSelected){
+ $new_password = $this->proposal;
+ $repeated_password = $this->proposal;
+ }else{
+ $new_password = get_post('new_password');
+ $repeated_password = get_post('repeated_password');
+ }
+
+ // Check posted passwords now.
+ $message= array();
+ if ($new_password != $repeated_password){
+ $message[]= _("The passwords you've entered as 'New password' and 'Repeated new password' do not match.");
+ } else {
+ if ($new_password == ""){
+ $message[] = msgPool::required(_("New password"));
+ }
+ }
+
+ // Display errors
+ if (count($message) != 0){
+ msg_dialog::displayChecks($message);
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+
+ // Change cassword
+ if(isset($this->force_hash_type[$this->dn])){
+ if(!change_password ($this->dn, $new_password,0,$this->force_hash_type[$this->dn])){
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+ }else{
+ if(!change_password ($this->dn, $new_password)){
+ return($smarty->fetch(get_template_path('password.tpl', TRUE)));
+ }
+ }
+ if ($this->config->get_cfg_value("core","passwordHook") != ""){
+ exec($this->config->get_cfg_value("core","passwordHook")." ".$username." ".$new_password, $resarr);
+ }
+ new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
+ $this->dn ="";
+
+ } else {
+ msg_dialog::display(_("Password change"),
+ _("You have no permission to change this users password!"),
+ WARNING_DIALOG);
}
- }
- if ($this->config->get_cfg_value("core","passwordHook") != ""){
- exec($this->config->get_cfg_value("core","passwordHook")." ".$username." ".$_POST['new_password'], $resarr);
- }
- new log("modify","users/".get_class($this),$this->dn,array(),"Password has been changed");
- $this->dn ="";
-
- } else {
- msg_dialog::display(_("Password change"),
- _("You have no permission to change this users password!"),
- WARNING_DIALOG);
}
// Cleanup
- if(!count($this->pwd_change_queue)){
+ if(!count($this->pwd_change_queue) && $this->dn=""){
$this->remove_lock();
$this->closeDialogs();
}else{
diff --git a/gosa-core/plugins/admin/users/password.tpl b/gosa-core/plugins/admin/users/password.tpl
index 6008f0ac84f792ce0c63b67d7b2bffe4adfcf1f6..04ec469a8c6e5a7792bfd652b0b4d461f3c67fb8 100644 (file)
{t}To change the user password use the fields below. The changes take effect immediately. Please memorize the new password, because the user wouldn't be able to login without it.{/t}
</p>
-<table summary="{t}Password input dialog{/t}" cellpadding=4 border=0>
- <tr>
- <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
- <td>
- {factory type='password' id='new_password' name='new_password'
- onfocus="nextfield='repeated_password';" onkeyup="testPasswordCss(\$('new_password').value);"}
- </td>
- </tr>
- <tr>
- <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
- <td>
- {factory type='password' id='repeated_password' name='repeated_password'
- onfocus="nextfield='password_finish';"}
- </td>
- </tr>
- <tr>
- <td><b>{t}Strength{/t}</b></td>
- <td>
- <span id="meterEmpty" style="padding:0;margin:0;width:100%;background-color:#DC143C;display:block;height:7px;">
- <span id="meterFull" style="padding:0;margin:0;z-index:100;width:0;background-color:#006400;display:block;height:7px;"></span></span>
- </td>
- </tr>
-</table>
+<hr>
+
+{if !$proposalEnabled}
+
+ <table summary="{t}Password input dialog{/t}" cellpadding=4 border=0>
+ <tr>
+ <td><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+ <td>
+ {factory type='password' id='new_password' name='new_password'
+ onfocus="nextfield='repeated_password';" onkeyup="testPasswordCss(\$('new_password').value);"}
+ </td>
+ </tr>
+ <tr>
+ <td><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+ <td>
+ {factory type='password' id='repeated_password' name='repeated_password'
+ onfocus="nextfield='password_finish';"}
+ </td>
+ </tr>
+ <tr>
+ <td><b>{t}Strength{/t}</b></td>
+ <td>
+ <span id="meterEmpty" style="padding:0;margin:0;width:100%;
+ background-color:#DC143C;display:block;height:7px;">
+ <span id="meterFull" style="padding:0;margin:0;z-index:100;width:0;
+ background-color:#006400;display:block;height:7px;"></span></span>
+ </td>
+ </tr>
+ </table>
+
+{else}
+
+ <table summary="{t}Password input dialog{/t}" cellpadding=4 border=0>
+ <tr>
+ <td>
+ <input type='radio' value='1' name='proposalSelected'
+ {if $proposalSelected} checked {/if}> <b>{t}Use proposal{/t}</b>
+ </td>
+ <td><b>{$proposal}</b> {image path='images/lists/reload.png' action='refreshProposal'}</td>
+ </tr>
+ <tr>
+ <td>
+ <input type='radio' value='0' name='proposalSelected'
+ {if !$proposalSelected} checked {/if}> <b>{t}Manually specify a password{/t}</b>
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:40px;'><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
+ <td>
+ {factory type='password' id='new_password' name='new_password'
+ onfocus="nextfield='repeated_password';" onkeyup="testPasswordCss(\$('new_password').value);"}
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:40px;'><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
+ <td>
+ {factory type='password' id='repeated_password' name='repeated_password'
+ onfocus="nextfield='password_finish';"}
+ </td>
+ </tr>
+ <tr>
+ <td style='padding-left:40px;'><b>{t}Strength{/t}</b></td>
+ <td>
+ <span id="meterEmpty" style="padding:0;margin:0;width:100%;
+ background-color:#DC143C;display:block;height:7px;">
+ <span id="meterFull" style="padding:0;margin:0;z-index:100;width:0;
+ background-color:#006400;display:block;height:7px;"></span></span>
+ </td>
+ </tr>
+ </table>
+
+{/if}
+
<br>
<hr>