From f00a3d5e107feb9be6f81a6d93515446f5e60c2f Mon Sep 17 00:00:00 2001
From: hickert
Date: Thu, 1 Jul 2010 15:08:21 +0000
Subject: [PATCH] Updated class password to support password proposal
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18908 594d385d-05f5-0310-b6e9-bd551577e9d8
---
.../personal/password/class_password.inc | 20 +++-
.../plugins/personal/password/password.tpl | 101 +++++++++++++-----
2 files changed, 91 insertions(+), 30 deletions(-)
diff --git a/gosa-core/plugins/personal/password/class_password.inc b/gosa-core/plugins/personal/password/class_password.inc
index 696e3e0d8..13cdb6144 100644
--- a/gosa-core/plugins/personal/password/class_password.inc
+++ b/gosa-core/plugins/personal/password/class_password.inc
@@ -27,18 +27,28 @@ class password extends plugin
var $plDescription = "Change user password";
var $proposal = "";
+ var $proposalEnabled = FALSE;
+ var $proposalSelected = FALSE;
function password(&$config, $dn= NULL, $parent= NULL)
{
plugin::plugin($config, $dn, $parent);
- $this->reloadProposal();
+ // Try to generate a password proposal, if this is successfull
+ // then preselect the proposal usage.
+ $this->refreshProposal();
+ if($this->proposal != ""){
+ $this->proposalSelected = TRUE;
+ }
}
- function reloadProposal()
+ function refreshProposal()
{
$this->proposal = passwordMethod::getPasswordProposal($this->config);
+ if($this->proposal != ""){
+ $this->proposalEnabled =TRUE;
+ }
}
@@ -60,6 +70,12 @@ class password extends plugin
return($smarty->fetch(get_template_path("nochange.tpl", TRUE)));
}
}
+
+ // Refresh proposal if requested
+ if(isset($_POST['refreshProposal'])) $this->refreshProposal();
+ $smarty->assign("proposal" , $this->proposal);
+ $smarty->assign("proposalEnabled" , $this->proposalEnabled);
+ $smarty->assign("proposalSelected" , $this->proposalSelected);
/* Pwd change requested */
if (isset($_POST['password_finish'])){
diff --git a/gosa-core/plugins/personal/password/password.tpl b/gosa-core/plugins/personal/password/password.tpl
index a7b7b29ff..7c9281830 100644
--- a/gosa-core/plugins/personal/password/password.tpl
+++ b/gosa-core/plugins/personal/password/password.tpl
@@ -4,35 +4,80 @@
{t}To change your personal password use the fields below. The changes take effect immediately. Please memorize the new password, because you wouldn't be able to login without it.{/t}
-
-
- |
-
- {factory type='password' name='current_password' id='current_password' onfocus="nextfield= 'new_password';"}
- |
-
-
- |
-
- {factory type='password' name='new_password' id='new_password'
- onkeyup="testPasswordCss(\$('new_password').value)" onfocus="nextfield= 'repeated_password';"}
- |
-
-
- |
-
- {factory type='password' name='repeated_password' id='repeated_password' onfocus="nextfield= 'password_finish';"}
- |
-
-
- {t}Password strength{/t} |
-
-
-
- |
-
-
+
+{if !proposalEnabled}
+
+
+ |
+
+ {factory type='password' name='current_password' id='current_password' onfocus="nextfield= 'new_password';"}
+ |
+
+
+ |
+
+ {factory type='password' name='new_password' id='new_password'
+ onkeyup="testPasswordCss(\$('new_password').value)" onfocus="nextfield= 'repeated_password';"}
+ |
+
+
+ |
+
+ {factory type='password' name='repeated_password' id='repeated_password' onfocus="nextfield= 'password_finish';"}
+ |
+
+
+ {t}Password strength{/t} |
+
+
+
+ |
+
+
+{else}
+
+{/if}
--
2.30.2