Fix issue with keylifetime being string
This commit is contained in:
parent
29d61cad41
commit
3e8c4138f0
2 changed files with 2 additions and 2 deletions
|
@ -93,7 +93,7 @@ class core_userkey_manager implements userkey_manager_interface {
|
||||||
$this->iprestriction = getremoteaddr(null);
|
$this->iprestriction = getremoteaddr(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($config->keylifetime) && is_int($config->keylifetime)) {
|
if (isset($config->keylifetime) && (int)$config->keylifetime > 0) {
|
||||||
$this->validuntil = time() + $config->keylifetime;
|
$this->validuntil = time() + $config->keylifetime;
|
||||||
} else {
|
} else {
|
||||||
$this->validuntil = time() + self::DEFAULT_KEY_LIFE_TIME_IN_SECONDS;
|
$this->validuntil = time() + self::DEFAULT_KEY_LIFE_TIME_IN_SECONDS;
|
||||||
|
|
|
@ -258,7 +258,7 @@ class core_userkey_manager_testcase extends advanced_testcase {
|
||||||
$expectedscript = 'auth/userkey';
|
$expectedscript = 'auth/userkey';
|
||||||
$expectedinstance = $this->user->id;
|
$expectedinstance = $this->user->id;
|
||||||
$expectediprestriction = null;
|
$expectediprestriction = null;
|
||||||
$expectedvaliduntil = time() + 60;
|
$expectedvaliduntil = time() + 3000;
|
||||||
|
|
||||||
$this->assertEquals($expectedvalue, $actualkey->value);
|
$this->assertEquals($expectedvalue, $actualkey->value);
|
||||||
$this->assertEquals($expecteduserid, $actualkey->userid);
|
$this->assertEquals($expecteduserid, $actualkey->userid);
|
||||||
|
|
Loading…
Reference in a new issue