Fixed minor things and added missing file
[vanilla-miry.git] / library / People / People.Control.PasswordRequestForm.php
blob3b04f036a44fa43073866046997ed9071ef69800
1 <?php
2 /**
3 * The PasswordRequestForm control is used to send password request emails
4 * to users who have potentially lost their password.
6 * Copyright 2003 Mark O'Sullivan
7 * This file is part of Lussumo's Software Library.
8 * 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.
9 * 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.
10 * 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
11 * The latest source code is available at www.lussumo.com
12 * Contact Mark O'Sullivan at mark [at] lussumo [dot] com
14 * @author Mark O'Sullivan
15 * @copyright 2003 Mark O'Sullivan
16 * @license http://lussumo.com/community/gpl.txt GPL 2
17 * @package People
18 * @version 1.1.8
22 /**
23 * The PasswordRequestForm control is used to send password request emails
24 * to users who have potentially lost their password.
25 * @package People
27 class PasswordRequestForm extends PostBackControl {
28 var $FormName; // The name of this form
29 var $EmailSentTo; // The email address to which the password reset request was sent
31 // Form Properties
32 var $Username;
34 function PasswordRequestForm(&$Context, $FormName = '') {
35 $this->Name = 'PasswordRequestForm';
36 $this->ValidActions = array('PasswordRequestForm', 'RequestPasswordReset');
37 $this->Constructor($Context);
39 if ($this->IsPostBack) {
40 $this->FormName = $FormName;
41 $this->Username = ForceIncomingString('Username', '');
42 // Set up the page
43 global $Banner, $Foot;
44 $Banner->Properties['CssClass'] = 'PasswordRequest';
45 $Foot->CssClass = 'PasswordRequest';
46 $this->Context->PageTitle = $this->Context->GetDefinition('PasswordResetRequest');
48 $this->UserManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'UserManager');
50 if ($this->PostBackAction == 'RequestPasswordReset') {
51 $this->EmailSentTo = $this->UserManager->RequestPasswordReset($this->Username);
52 $aEmailSentTo = explode('@', $this->EmailSentTo);
53 if (count($aEmailSentTo) > 1) {
54 $this->EmailSentTo = $aEmailSentTo[1];
56 if ($this->EmailSentTo) $this->PostBackValidated = 1;
58 $this->CallDelegate('LoadData');
62 function Render_ValidPostBack() {
63 $this->CallDelegate('PreValidPostBackRender');
64 include(ThemeFilePath($this->Context->Configuration, 'people_password_request_form_validpostback.php'));
65 $this->CallDelegate('PostValidPostBackRender');
68 function Render_NoPostBack() {
69 $this->CallDelegate('PreNoPostBackRender');
70 $this->PostBackParams->Add('PostBackAction', 'RequestPasswordReset');
71 include(ThemeFilePath($this->Context->Configuration, 'people_password_request_form_nopostback.php'));
72 $this->CallDelegate('PostNoPostBackRender');