forked from Open-Web-Analytics/Open-Web-Analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored validation and validator objects to be object oriented and…
… configurable by controllers. added stringMatch and stringLength validations. added password form coontroller.
- Loading branch information
padams
committed
Jan 8, 2009
1 parent
cb9aa48
commit fbf983e
Showing
20 changed files
with
675 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
// | ||
// Open Web Analytics - An Open Source Web Analytics Framework | ||
// | ||
// Copyright 2006 Peter Adams. All rights reserved. | ||
// | ||
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// $Id$ | ||
// | ||
|
||
require_once(OWA_BASE_DIR.'/owa_view.php'); | ||
require_once(OWA_BASE_DIR.'/owa_controller.php'); | ||
|
||
/** | ||
* Password Reset Request Controller | ||
* | ||
* @author Peter Adams <[email protected]> | ||
* @copyright Copyright © 2006 Peter Adams <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 | ||
* @category owa | ||
* @package owa | ||
* @version $Revision$ | ||
* @since owa 1.0.0 | ||
*/ | ||
|
||
class owa_passwordResetFormController extends owa_controller { | ||
|
||
function owa_passwordResetFormController($params) { | ||
|
||
return owa_passwordResetFormController::__construct($params); | ||
} | ||
|
||
function __construct($params) { | ||
|
||
return parent::__construct($params); | ||
} | ||
|
||
function action() { | ||
|
||
$this->setView('base.passwordResetForm'); | ||
|
||
return; | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Password Reset Request View | ||
* | ||
* @author Peter Adams <[email protected]> | ||
* @copyright Copyright © 2006 Peter Adams <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 | ||
* @category owa | ||
* @package owa | ||
* @version $Revision$ | ||
* @since owa 1.0.0 | ||
*/ | ||
|
||
class owa_passwordResetFormView extends owa_view { | ||
|
||
function owa_passwordResetFormView() { | ||
|
||
return owa_passwordResetFormView::__construct(); | ||
} | ||
|
||
function __construct() { | ||
|
||
return parent::__construct(); | ||
} | ||
|
||
function render($data) { | ||
$this->t->set_template('wrapper_public.tpl'); | ||
$this->body->set_template('users_password_reset_request.tpl'); | ||
return; | ||
} | ||
|
||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,41 +16,7 @@ | |
// $Id$ | ||
// | ||
|
||
require_once(OWA_BASE_DIR.'/owa_view.php'); | ||
require_once(OWA_BASE_DIR.'/owa_adminController.php'); | ||
|
||
/** | ||
* Password Reset Request View | ||
* | ||
* @author Peter Adams <[email protected]> | ||
* @copyright Copyright © 2006 Peter Adams <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 | ||
* @category owa | ||
* @package owa | ||
* @version $Revision$ | ||
* @since owa 1.0.0 | ||
*/ | ||
|
||
class owa_passwordResetRequestView extends owa_view { | ||
|
||
function owa_passwordResetRequest($params) { | ||
|
||
$this->owa_view($params); | ||
|
||
return; | ||
} | ||
|
||
function construct($data) { | ||
|
||
$this->body->set_template('users_password_reset_request.tpl');// This is the inner template | ||
$this->body->set('headline', 'Type in the email address that is associated with your user account.'); | ||
$this->body->set('u', $this->params['u']); | ||
|
||
return; | ||
} | ||
|
||
} | ||
|
||
require_once(OWA_BASE_DIR.'/owa_controller.php'); | ||
|
||
/** | ||
* Password Reset Request Controller | ||
|
@@ -64,43 +30,44 @@ function construct($data) { | |
* @since owa 1.0.0 | ||
*/ | ||
|
||
class owa_passwordResetRequestController extends owa_adminController { | ||
class owa_passwordResetRequestController extends owa_controller { | ||
|
||
function owa_passwordResetRequestController($params) { | ||
$this->owa_adminController($params); | ||
$this->priviledge_level = 'guest'; | ||
|
||
return; | ||
return owa_passwordResetRequestController::__construct($params); | ||
} | ||
|
||
function doAction() { | ||
function __construct($params) { | ||
|
||
return parent::__construct($params); | ||
} | ||
|
||
function action() { | ||
|
||
// Check to see if this email exists in the db | ||
$u = new owa_user; | ||
$u->getUserByEmail($this->params['email_address']); | ||
// fetch user object from the db | ||
$u = owa_coreAPI::entityFactory('base.user'); | ||
$u->getByColumn('email_address', $this->getParam('email_address')); | ||
$uid = $u->get('user_id'); | ||
|
||
$data = array(); | ||
|
||
// If user exists then fire event and return view | ||
if (!empty($u->user_id)): | ||
if (!empty($uid)) { | ||
|
||
// Log password reset request to event queue | ||
$eq = &eventQueue::get_instance(); | ||
$eq->log(array('user_id' => $u->user_id), 'base.reset_password'); | ||
$eq->log(array('user_id' => $uid), 'base.reset_password'); | ||
|
||
// return view | ||
$data['view'] = 'base.passwordResetRequest'; | ||
$data['view_method'] = 'delegate'; | ||
$data['status_msg'] = $this->getMsg(2000, $this->params['email_address']); | ||
$this->setView('base.passwordResetForm'); | ||
$this->set('status_msg', $this->getMsg(2000, $this->getParam('email_address'))); | ||
|
||
// if user does not exists just return view with error | ||
else: | ||
$data['view'] = 'base.passwordResetRequest'; | ||
$data['view_method'] = 'delegate'; | ||
$data['error_msg'] = $this->getMsg(2001, $this->params['email_address']); | ||
endif; | ||
} else { | ||
$this->setView('base.passwordResetForm'); | ||
$this->set('error_msg', $this->getMsg(2001, $this->getParam('email_address'))); | ||
} | ||
|
||
return $data; | ||
return; | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.