<?php
/***************************************************************************
*
* ChangePassword.php
* --------------------
*
* begin : Friday, Nov 17, 2002
* copyright : (C) 2002 The Kabramps Team
* email : hide@address.com,
* hide@address.com
*
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
* (http://www.gnu.org/licenses/gpl.html)
*
***************************************************************************/
class ChangePassword extends Addon {
var $completed;
var $password;
var $attribute;
function ChangePassword() {
}
function get_view() {
global $HTTP_GET_VARS;
global $HTTP_POST_VARS;
if ($HTTP_GET_VARS["attribname"] == "") {
die(gettext("Missing nesessary parameter."));
}
$this->attribute = $HTTP_GET_VARS["attribname"];
$tmpls = new Smarty;
if ($HTTP_POST_VARS["submit"]) {
if ($HTTP_POST_VARS["newpw"] != "") {
if ($HTTP_POST_VARS["newpw_repeat"] != "") {
if ($HTTP_POST_VARS["newpw"] == $HTTP_POST_VARS["newpw_repeat"]) {
$this->password = '{CRYPT}'.crypt($HTTP_POST_VARS["newpw_repeat"]);
$this->statusMessage = gettext("New password set");
$this->statusImage = "images/lock_closed.png";
$this->completed = true;
} else {
$error = gettext("The repeated password do not match with the new password. Please try again.");
}
} else {
$error = gettext("Please repeat the new password.");
}
} else {
$this->password = '';
$this->statusMessage = gettext("Password removed");
$this->statusImage = "images/lock_open";
$this->completed = true;
}
}
$tmpls->assign(array("PAGETITLE" => gettext("LDAPted: change password."),
"CAPTION" => gettext("Change password"),
"ERRORMESSAGE" => $error,
"L_NEWPW" => gettext("new password"),
"L_NEWPW_REPEAT" => gettext("repeat new password"),
"SUBMIT" => gettext("change password"),
"RESET" => gettext("cancel"),
));
return $tmpls->fetch("addons/changepassword.tpl");
}
function onload() {
if ( $this->completed ) {
return "changepassword('".$this->attribute."', '".$this->password."', '".$this->statusImage."', '".$this->statusMessage."');";
}
}
function get_jsfile() {
global $options;
return array($options['templates']."addons/changepassword.js");
}
}
?>