3 * The PasswordForm control allows users to change their password in Vanilla.
5 * Copyright 2003 Mark O'Sullivan
6 * This file is part of Lussumo's Software Library.
7 * Lussumo's Software Library 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.
8 * Lussumo's Software Library 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.
9 * You should have received a copy of the GNU General Public License along with Vanilla; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
10 * The latest source code is available at www.lussumo.com
11 * Contact Mark O'Sullivan at mark [at] lussumo [dot] com
13 * @author Mark O'Sullivan
14 * @copyright 2003 Mark O'Sullivan
15 * @license http://lussumo.com/community/gpl.txt GPL 2
22 * The PasswordForm control allows users to change their password in Vanilla.
25 class PasswordForm
extends PostBackControl
{
29 function PasswordForm (&$Context, &$UserManager, $UserID) {
30 $this->Name
= 'PasswordForm';
31 if ($Context->Configuration
['ALLOW_PASSWORD_CHANGE']) $this->ValidActions
= array('ProcessPassword', 'Password');
32 $this->Constructor($Context);
33 if ($this->IsPostBack
) {
34 $this->UserManager
= &$UserManager;
35 $this->User
= $this->Context
->ObjectFactory
->NewContextObject($Context, 'User');
36 $this->User
->GetPropertiesFromForm();
37 $this->User
->UserID
= $UserID;
38 if ($this->PostBackAction
== 'ProcessPassword' && $this->IsValidFormPostBack()) {
39 if ($this->UserManager
->ChangePassword($this->User
)) {
40 $this->CallDelegate('PostPasswordChange');
41 $Url = GetUrl($this->Context
->Configuration
, $this->Context
->SelfUrl
, '', '','','','Success=1');
42 Redirect($Url, '302', '', 0);
46 $this->CallDelegate('Constructor');
50 if ($this->IsPostBack
) {
51 $this->CallDelegate('PreRender');
52 include(ThemeFilePath($this->Context
->Configuration
, 'account_password_form.php'));
53 $this->CallDelegate('PostRender');