Code

Prepared statistics to handle over-time data
[gosa.git] / gosa-core / html / password.php
index 4880f71979a70960fb0a1a11a048c2858f6eb98c..954231dfe3890fb26f4f2ac3bfc8018ab12c8700 100644 (file)
@@ -24,6 +24,8 @@ function displayPWchanger()
 {
     global $smarty;
 
+    $smarty->assign ("logo", image(get_template_path("images/logo.png")));
+    $smarty->assign ("date", date("l, dS F Y H:i:s O"));
     $smarty->display(get_template_path('password.tpl'));
     exit();
 }
@@ -68,6 +70,33 @@ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)) {
 
 /* Parse configuration file */
 $config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR);
+
+/* Generate server list */
+$servers= array();
+foreach ($config->data['LOCATIONS'] as $key => $ignored) {
+    $servers[$key]= $key;
+}
+
+if (isset($_POST['server'])) {
+    $directory= get_post('server');
+}elseif (isset($_GET['directory'])) {
+    $directory= $_GET['directory'];
+} else {
+    $directory= $config->data['MAIN']['DEFAULT'];
+    if (!isset($servers[$directory])) {
+        $directory = key($servers);
+    }
+    
+}
+
+// Set location and reload the configRegistry - we've now access to the ldap. 
+if(isset($servers[$directory])){
+    $config->set_current($directory);
+    $config->check_and_reload();
+    $config->configRegistry->reload(TRUE);
+}
+session::global_set('plist', new pluglist($config, $ui));
+
 session::global_set('debugLevel', $config->get_cfg_value("core","debugLevel"));
 if ($_SERVER["REQUEST_METHOD"] != "POST") {
     @DEBUG(
@@ -112,20 +141,6 @@ $domain = 'messages';
 bindtextdomain($domain, LOCALE_DIR);
 textdomain($domain);
 
-/* Generate server list */
-$servers= array();
-foreach ($config->data['LOCATIONS'] as $key => $ignored) {
-    $servers[$key]= $key;
-}
-if (isset($_POST['server'])) {
-    $directory= validate($_POST['server']);
-} else {
-    $directory= $config->data['MAIN']['DEFAULT'];
-
-    if (!isset($servers[$directory])) {
-        $directory = key($servers);
-    }
-}
 $smarty->assign ("title","GOsa");
 if (isset($_GET['directory']) && isset($servers[$_GET['directory']])) {
     $smarty->assign("show_directory_chooser", false);
@@ -172,7 +187,7 @@ if ($config->get_cfg_value("core","forceSSL") == 'true' && $ssl != '') {
 $method= $config->get_cfg_value("core","passwordDefaultHash");
 if (isset($_GET['method'])) {
     $method= validate($_GET['method']);
-    $tmp = new passwordMethod($config);
+    $tmp = new passwordMethod($config, "dummy");
     $available = $tmp->get_available_methods();
     if (!isset($available[$method])) {
         msg_dialog::display(
@@ -190,7 +205,7 @@ if (isset($_GET['uid']) && $_GET['uid'] != "") {
     $uid= validate($_GET['uid']);
     $smarty->assign('display_username', false);
 } elseif (isset($_POST['uid'])) {
-    $uid= validate($_POST['uid']);
+    $uid= get_post('uid');
     $smarty->assign('display_username', true);
 } else {
     $uid= "";
@@ -235,7 +250,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])) {
         }
     }
     if(!passwordMethod::is_harmless($_POST['new_password'])){
-        $message[]= _("The password contains possibly problematic unicode characters!");
+        $message[]= _("The password contains possibly problematic Unicode characters!");
     }
 
     /* Validate */
@@ -248,6 +263,13 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['apply'])) {
         /* Do we have the selected user somewhere? */
         $ui= ldap_login_user($uid, $current_password);
 
+        /* Load ocMapping into userinfo */
+        $tmp= new acl($config, NULL, $ui->dn);
+        $ui->ocMapping= $tmp->ocMapping;
+
+
+        $ui->loadACL();
+
         if ($ui === NULL) {
             $message[]= _("Please check the username/password combination!");
         } else {