More fixes related to password reset
This commit is contained in:
parent
79c76995b9
commit
3ce74636f7
@ -21,11 +21,6 @@ class Auth_OSB extends Auth_ORM {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function logged_in($role=NULL,$debug=NULL) {
|
public function logged_in($role=NULL,$debug=NULL) {
|
||||||
static $status = NULL;
|
|
||||||
|
|
||||||
if (! is_null($status))
|
|
||||||
return $status;
|
|
||||||
|
|
||||||
$status = FALSE;
|
$status = FALSE;
|
||||||
|
|
||||||
// Get the user from the session
|
// Get the user from the session
|
||||||
@ -109,11 +104,6 @@ class Auth_OSB extends Auth_ORM {
|
|||||||
$status = TRUE;
|
$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 {
|
} else {
|
||||||
if (Config::sitemode() == Kohana::DEVELOPMENT)
|
if (Config::sitemode() == Kohana::DEVELOPMENT)
|
||||||
SystemMessage::add(array('title'=>'Debug','type'=>'debug','body'=>'No user logged in'));
|
SystemMessage::add(array('title'=>'Debug','type'=>'debug','body'=>'No user logged in'));
|
||||||
@ -130,10 +120,11 @@ class Auth_OSB extends Auth_ORM {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get_user($default=NULL,$tokenuser=TRUE) {
|
public function get_user($default=NULL,$tokenuser=TRUE) {
|
||||||
|
// Get the current user
|
||||||
$uo = parent::get_user($default);
|
$uo = parent::get_user($default);
|
||||||
|
|
||||||
// If we are not logged in, see if there is token for the user
|
// 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);
|
$uo = $this->_get_token_user($token);
|
||||||
|
|
||||||
return $uo;
|
return $uo;
|
||||||
|
@ -17,7 +17,7 @@ class Controller_TemplateDefault extends lnApp_Controller_TemplateDefault {
|
|||||||
|
|
||||||
public function __construct(Request $request, Response $response) {
|
public function __construct(Request $request, Response $response) {
|
||||||
if (Config::theme())
|
if (Config::theme())
|
||||||
$this->template = 'theme/'.Config::theme().'/page';
|
$this->template = Config::theme().'/page';
|
||||||
|
|
||||||
return parent::__construct($request,$response);
|
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()));
|
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();
|
$this->ao = Auth::instance()->get_user();
|
||||||
|
|
||||||
if (! is_null($this->ao) AND (is_string($this->ao) OR ! $this->ao->loaded()))
|
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));
|
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));
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,8 @@ class Kohana_Exception extends Kohana_Kohana_Exception {
|
|||||||
SystemMessage::add(array(
|
SystemMessage::add(array(
|
||||||
'title'=>'An Error Occured.',
|
'title'=>'An Error Occured.',
|
||||||
'type'=>'error',
|
'type'=>'error',
|
||||||
'body'=>'A error occured, which has been logged.',
|
'body'=>'Dont panic, its been logged.',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
// We'll redirect to the main page.
|
// We'll redirect to the main page.
|
||||||
$response = Response::factory();
|
$response = Response::factory();
|
||||||
|
@ -31,7 +31,7 @@ abstract class lnApp_Controller_Media extends Controller {
|
|||||||
$this->response->body($fd);
|
$this->response->body($fd);
|
||||||
|
|
||||||
// First try and find media files for the theme-site_id
|
// 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
|
// Send the file content as the response
|
||||||
$this->response->body(file_get_contents($f));
|
$this->response->body(file_get_contents($f));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user