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.
added refactored login form controller
added check for data in ofc clas before trying to redner forms
- Loading branch information
padams
committed
Jan 8, 2009
1 parent
b119594
commit cb9aa48
Showing
16 changed files
with
236 additions
and
127 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 |
---|---|---|
|
@@ -16,84 +16,56 @@ | |
// $Id$ | ||
// | ||
|
||
require_once(OWA_BASE_DIR.'/owa_view.php'); | ||
require_once(OWA_BASE_DIR.'/owa_controller.php'); | ||
require_once(OWA_BASE_DIR.'/owa_auth.php'); | ||
|
||
/** | ||
* Login 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_loginView extends owa_view { | ||
|
||
function owa_loginView() { | ||
|
||
$this->owa_view(); | ||
$this->priviledge_level = 'guest'; | ||
|
||
return; | ||
} | ||
|
||
function construct($data) { | ||
|
||
$this->body->set_template('login_form.tpl');// This is the inner template | ||
$this->body->set('headline', 'Please login using the from below'); | ||
$this->body->set('user_id', $data['user_id']); | ||
$this->body->set('go', $data['go']); | ||
|
||
} | ||
} | ||
|
||
class owa_loginController extends owa_controller { | ||
|
||
function owa_loginController($params) { | ||
$this->owa_controller($params); | ||
$this->priviledge_level = 'guest'; | ||
|
||
return owa_loginController::__construct($params); | ||
} | ||
|
||
return; | ||
function __construct($params) { | ||
|
||
return parent::__construct($params); | ||
} | ||
|
||
function action() { | ||
|
||
$auth = &owa_auth::get_instance(); | ||
$status = $auth->authenticateNewBrowser($this->params['user_id'], $this->params['password']); | ||
$data = array(); | ||
|
||
$status = $auth->authenticateNewBrowser($this->getParam('user_id'), $this->getParam('password')); | ||
$go = $this->getParam('go'); | ||
// if authentication is successfull | ||
if ($status['auth_status'] == true): | ||
if ($status['auth_status'] == true) { | ||
|
||
// redirect to url if present | ||
if (!empty($this->params['go'])): | ||
$url = urldecode($this->params['go']); | ||
|
||
if (!empty($go)) { | ||
// redirect to url if present | ||
$url = urldecode($go); | ||
$this->e->debug("redirecting browser to...:". $url); | ||
owa_lib::redirectBrowser($url); | ||
//else redirect to home page | ||
else: | ||
$data['view_method'] = 'redirect'; | ||
$data['do'] = $this->config['start_page']; | ||
endif; | ||
// return error view | ||
else: | ||
|
||
$data['view_method'] = 'delegate'; | ||
$data['view'] = 'base.login'; | ||
$data['go'] = urldecode($this->params['go']); | ||
$data['go'] = urlencode($this->params['go']); | ||
$data['error_msg'] = $this->getMsg(2002); | ||
$data['user_id'] = $this->params['user_id']; | ||
|
||
} else { | ||
//else redirect to home page | ||
|
||
// these need to be unset as they were set previously by the doAction method. | ||
// need to refactor this out. | ||
$this->set('auth_status', ''); | ||
$this->set('params', ''); | ||
$this->set('site_id', ''); | ||
$this->setRedirectAction($this->config['start_page']); | ||
} | ||
|
||
} else { | ||
// return login form with error msg | ||
$this->setView('base.loginForm'); | ||
$this->set('go', $go); | ||
$this->set('error_code', 2002); | ||
$this->set('user_id', $this->getParam('user_id')); | ||
|
||
endif; | ||
} | ||
|
||
return $data; | ||
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?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'); | ||
require_once(OWA_BASE_DIR.'/owa_auth.php'); | ||
|
||
/** | ||
* Login Form 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_loginFormController extends owa_controller { | ||
|
||
function owa_loginFormController($params) { | ||
|
||
|
||
return owa_loginFormController::__construct($params); | ||
} | ||
|
||
function __construct($params) { | ||
|
||
return parent::__construct($params); | ||
} | ||
|
||
function action() { | ||
|
||
$auth = &owa_auth::get_instance(); | ||
$this->set('go', $this->getParam('go')); | ||
$this->set('user_id', $this->getParam('u')); | ||
$this->setView('base.loginForm'); | ||
|
||
return; | ||
} | ||
|
||
|
||
} | ||
|
||
/** | ||
* Login Form 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_loginFormView extends owa_view { | ||
|
||
function owa_loginFormView() { | ||
|
||
return owa_loginFormView::__construct(); | ||
} | ||
|
||
function __construct() { | ||
|
||
return parent::__construct(); | ||
} | ||
|
||
function construct($data) { | ||
|
||
$this->t->set_template('wrapper_public.tpl'); | ||
$this->body->set_template('login_form.tpl');// This is the inner template | ||
$this->body->set('headline', 'Please login using the from below'); | ||
$this->body->set('user_id', $this->get('user_id')); | ||
$this->body->set('go', $this->get('go')); | ||
|
||
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
<div class="error"><?=$error_msg;?></div> | ||
<div class=""><?=$error_msg;?></div> |
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
Oops, something went wrong.