Fix for token password reset
This commit is contained in:
@@ -129,10 +129,9 @@ class Auth_OSB extends Auth_ORM {
|
||||
public function get_user($tokenuser=TRUE) {
|
||||
$user = parent::get_user();
|
||||
|
||||
// If we are not logged in, see if there is token for the usre
|
||||
if ($tokenuser AND $user === FALSE AND $token=Session::instance()->get('token')) {
|
||||
// If we are not logged in, see if there is token for the user
|
||||
if ($tokenuser AND $user === NULL AND $token=Session::instance()->get('token'))
|
||||
$user = $this->_get_token_user($token);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
@@ -94,9 +94,13 @@ class Model_Module_Method_Token extends ORM_OSB {
|
||||
->find();
|
||||
|
||||
if ($mmto->loaded()) {
|
||||
if ((is_null($mmto->date_expire) OR $mmto->date_expire > time()) AND (is_null($mmto->uses) OR $mmto->uses > 0))
|
||||
return $mmto->token;
|
||||
else
|
||||
// Check that the token is still good
|
||||
if ((is_null($mmto->date_expire) OR $mmto->date_expire > time()) AND (is_null($mmto->uses) OR $mmto->uses > 0)) {
|
||||
$this->token = $mmto->token;
|
||||
return $this->token;
|
||||
|
||||
// Token expired
|
||||
} else
|
||||
$mmto->delete();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user