More fixes related to password reset

This commit is contained in:
Deon George 2013-04-21 23:10:38 +10:00
parent 79c76995b9
commit 3ce74636f7
4 changed files with 6 additions and 15 deletions

View File

@ -21,11 +21,6 @@ class Auth_OSB extends Auth_ORM {
* @return boolean
*/
public function logged_in($role=NULL,$debug=NULL) {
static $status = NULL;
if (! is_null($status))
return $status;
$status = FALSE;
// Get the user from the session
@ -109,11 +104,6 @@ class Auth_OSB extends Auth_ORM {
$status = TRUE;
}
// Check and see if we have a token to login and run the method
} elseif ((! empty($_REQUEST['token']) AND $token = $_REQUEST['token']) OR $token=Session::instance()->get('token')) {
if (! is_null($this->_get_token_user($token)))
$status = TRUE;
} else {
if (Config::sitemode() == Kohana::DEVELOPMENT)
SystemMessage::add(array('title'=>'Debug','type'=>'debug','body'=>'No user logged in'));
@ -130,10 +120,11 @@ class Auth_OSB extends Auth_ORM {
* @return mixed
*/
public function get_user($default=NULL,$tokenuser=TRUE) {
// Get the current user
$uo = parent::get_user($default);
// If we are not logged in, see if there is token for the user
if (is_null($uo) AND $tokenuser AND $token=Session::instance()->get('token'))
if (is_null($uo) AND $tokenuser AND ($token=Session::instance()->get('token')) OR (! empty($_REQUEST['token']) AND $token=$_REQUEST['token']))
$uo = $this->_get_token_user($token);
return $uo;

View File

@ -17,7 +17,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
public function __construct(Request $request, Response $response) {
if (Config::theme())
$this->template = 'theme/'.Config::theme().'/page';
$this->template = Config::theme().'/page';
return parent::__construct($request,$response);
}
@ -56,6 +56,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
throw new Kohana_Exception('Class has no security defined :class, or no security configured for :method',array(':class'=>get_class($this),':method'=>Request::current()->action()));
$this->ao = Auth::instance()->get_user();
if (! is_null($this->ao) AND (is_string($this->ao) OR ! $this->ao->loaded()))
throw HTTP_Exception::factory(501,'Account doesnt exist :account ?',array(':account'=>(is_string($this->ao) OR is_null($this->ao)) ? $this->ao : Auth::instance()->get_user()->id));
}

View File

@ -46,10 +46,9 @@ class Kohana_Exception extends Kohana_Kohana_Exception {
SystemMessage::add(array(
'title'=>'An Error Occured.',
'type'=>'error',
'body'=>'A error occured, which has been logged.',
'body'=>'Dont panic, its been logged.',
));
// We'll redirect to the main page.
$response = Response::factory();
$response->status(302);

View File

@ -31,7 +31,7 @@ abstract class lnApp_Controller_Media extends Controller {
$this->response->body($fd);
// First try and find media files for the theme-site_id
} elseif ($f = Kohana::find_file($x=sprintf('media/site/%s/theme/%s',Config::siteid(),Config::theme()),$file,$ext)) {
} elseif ($f = Kohana::find_file($x=sprintf('media/site/%s/%s',Config::siteid(),Config::theme()),$file,$ext)) {
// Send the file content as the response
$this->response->body(file_get_contents($f));