mirror of https://github.com/MISP/MISP
[chg] LinOTP now with enable/disable as config feature
parent
ca036781ca
commit
eb7a1301bb
|
@ -7177,6 +7177,12 @@ class Server extends AppModel
|
|||
),
|
||||
'LinOTPAuth' => array(
|
||||
'branch' => 1,
|
||||
'enabled' => array(
|
||||
'level' => 2,
|
||||
'description' => __('Enable / Disable LinOTP'),
|
||||
'value' => true,
|
||||
'type' => 'boolean',
|
||||
),
|
||||
'baseUrl' => array(
|
||||
'level' => 2,
|
||||
'description' => __('The default LinOTP URL.'),
|
||||
|
|
|
@ -123,6 +123,13 @@ class LinOTPAuthenticate extends BaseAuthenticate
|
|||
|
||||
CakeLog::debug("getUser email: ${email}");
|
||||
|
||||
$linOTP_enabled = Configure::read("LinOTPAuth.enabled");
|
||||
if (is_null($linOTP_enabled)) {
|
||||
$linOTP_enabled = TRUE;
|
||||
}
|
||||
if (!$linOTP_enabled) {
|
||||
return false;
|
||||
}
|
||||
$linOTP_baseUrl = rtrim(Configure::read("LinOTPAuth.baseUrl"), "/");
|
||||
$linOTP_realm = Configure::read("LinOTPAuth.realm");
|
||||
$linOTP_verifyssl = Configure::read("LinOTPAuth.verifyssl");
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<?php
|
||||
echo $this->Form->input('email', array('autocomplete' => 'off', 'autofocus'));
|
||||
echo $this->Form->input('password', array('autocomplete' => 'off'));
|
||||
if (!empty(Configure::read('LinOTPAuth'))) {
|
||||
if (!empty(Configure::read('LinOTPAuth')) && Configure::read('LinOTPAuth.enabled')!== FALSE) {
|
||||
echo $this->Form->input('otp', array('autocomplete' => 'off', 'type' => 'password', 'label' => 'OTP'));
|
||||
echo "<div class=\"clear\">";
|
||||
echo sprintf(
|
||||
|
@ -92,7 +92,7 @@ function submitLoginForm() {
|
|||
var url = $form.attr('action')
|
||||
var email = $form.find('#UserEmail').val()
|
||||
var password = $form.find('#UserPassword').val()
|
||||
if (!empty(Configure::read('LinOTPAuth'))) {
|
||||
if (!empty(Configure::read('LinOTPAuth')) && Configure::read('LinOTPAuth.enabled')) {
|
||||
var otp = $form.find('#UserOtp').val()
|
||||
}
|
||||
if (!$form[0].checkValidity()) {
|
||||
|
@ -107,7 +107,7 @@ function submitLoginForm() {
|
|||
var $tmpForm = $('#temp form#UserLoginForm')
|
||||
$tmpForm.find('#UserEmail').val(email)
|
||||
$tmpForm.find('#UserPassword').val(password)
|
||||
if (!empty(Configure::read('LinOTPAuth'))) {
|
||||
if (!empty(Configure::read('LinOTPAuth')) && Configure::read('LinOTPAuth.enabled')) {
|
||||
$tmpForm.find('#UserOtp').val(otp)
|
||||
}
|
||||
$tmpForm.submit()
|
||||
|
|
Loading…
Reference in New Issue