mirror of https://github.com/MISP/MISP
fix: [OTP] restored
parent
9f3735c5c2
commit
bf909d5fff
|
@ -925,7 +925,7 @@ class ACLComponent extends Component
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
$this->dynamicChecks['otp_enabled'] = function (array $user) {
|
$this->dynamicChecks['otp_enabled'] = function ($user) {
|
||||||
if (Configure::read('Security.otp_disabled')) {
|
if (Configure::read('Security.otp_disabled')) {
|
||||||
throw new ForbiddenException('OTP has been disabled on this instance.');
|
throw new ForbiddenException('OTP has been disabled on this instance.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1214,11 +1214,13 @@ class UsersController extends AppController
|
||||||
$this->Auth->constructAuthenticate();
|
$this->Auth->constructAuthenticate();
|
||||||
}
|
}
|
||||||
// user has TOTP token, check creds and redirect to TOTP validation
|
// user has TOTP token, check creds and redirect to TOTP validation
|
||||||
if (!empty($unauth_user['User']['totp']) && !$unauth_user['User']['disabled'] && class_exists('\OTPHP\TOTP')) {
|
if (!Configure::read('Security.otp_disabled')) {
|
||||||
$user = $this->Auth->identify($this->request, $this->response);
|
if (!empty($unauth_user['User']['totp']) && !$unauth_user['User']['disabled'] && class_exists('\OTPHP\TOTP')) {
|
||||||
if ($user && !$user['disabled']) {
|
$user = $this->Auth->identify($this->request, $this->response);
|
||||||
$this->Session->write('otp_user', $user);
|
if ($user && !$user['disabled']) {
|
||||||
return $this->redirect('otp');
|
$this->Session->write('otp_user', $user);
|
||||||
|
return $this->redirect('otp');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue