mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +00:00
include autoload.php instead of robthree classes
This commit is contained in:
parent
25657c2f64
commit
4e9d241108
|
@ -130,6 +130,17 @@ if ($user->isAdmin() && ($_SERVER['REMOTE_ADDR'] != $settings->_adminIP ) && ( $
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($settings->_enable2FactorAuthentication) {
|
||||||
|
if($secret = $user->getSecret()) {
|
||||||
|
require "vendor/autoload.php";
|
||||||
|
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
|
||||||
|
if($tfa->verifyCode($secret, $_POST['twofactauth']) !== true) {
|
||||||
|
_printMessage(getMLText("login_error_title"), getMLText("login_error_text"));
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Clear login failures if login was successful */
|
/* Clear login failures if login was successful */
|
||||||
$user->clearLoginFailures();
|
$user->clearLoginFailures();
|
||||||
|
|
||||||
|
|
37
out/out.Setup2Factor.php
Normal file
37
out/out.Setup2Factor.php
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Setup 2-factor authentication
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2016 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
include("../inc/inc.Settings.php");
|
||||||
|
include("../inc/inc.Language.php");
|
||||||
|
include("../inc/inc.Init.php");
|
||||||
|
include("../inc/inc.Extension.php");
|
||||||
|
include("../inc/inc.DBInit.php");
|
||||||
|
include("../inc/inc.ClassUI.php");
|
||||||
|
include("../inc/inc.Authentication.php");
|
||||||
|
|
||||||
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
|
||||||
|
$accessop = new SeedDMS_AccessOperation($dms, $user, $settings);
|
||||||
|
|
||||||
|
if ($user->isGuest()) {
|
||||||
|
UI::exitError(getMLText("2_factor_auth"),getMLText("access_denied"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($view) {
|
||||||
|
$view->setParam('sitename', $settings->_siteName);
|
||||||
|
$view->setParam('enable2factauth', $settings->_enable2FactorAuthentication);
|
||||||
|
$view->setParam('accessobject', $accessop);
|
||||||
|
$view($_GET);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
114
views/bootstrap/class.Setup2Factor.php
Normal file
114
views/bootstrap/class.Setup2Factor.php
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Implementation of Setup2Factor view
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @license GPL 2
|
||||||
|
* @version @version@
|
||||||
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2016 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include parent class
|
||||||
|
*/
|
||||||
|
require_once("class.Bootstrap.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Include classes for 2-factor authentication
|
||||||
|
*/
|
||||||
|
require "vendor/autoload.php";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class which outputs the html page for ForcePasswordChange view
|
||||||
|
*
|
||||||
|
* @category DMS
|
||||||
|
* @package SeedDMS
|
||||||
|
* @author Markus Westphal, Malcolm Cowe, Uwe Steinmann <uwe@steinmann.cx>
|
||||||
|
* @copyright Copyright (C) 2016 Uwe Steinmann
|
||||||
|
* @version Release: @package_version@
|
||||||
|
*/
|
||||||
|
class SeedDMS_View_Setup2Factor extends SeedDMS_Bootstrap_Style {
|
||||||
|
|
||||||
|
function js() { /* {{{ */
|
||||||
|
header('Content-Type: application/javascript');
|
||||||
|
?>
|
||||||
|
function checkForm()
|
||||||
|
{
|
||||||
|
msg = new Array();
|
||||||
|
|
||||||
|
if($("#currentpwd").val() == "") msg.push("<?php printMLText("js_no_pwd");?>");
|
||||||
|
if($("#pwd").val() == "") msg.push("<?php printMLText("js_no_pwd");?>");
|
||||||
|
if($("#pwd").val() != $("#pwdconf").val()) msg.push("<?php printMLText("js_pwd_not_conf");?>");
|
||||||
|
if (msg != "") {
|
||||||
|
noty({
|
||||||
|
text: msg.join('<br />'),
|
||||||
|
type: 'error',
|
||||||
|
dismissQueue: true,
|
||||||
|
layout: 'topRight',
|
||||||
|
theme: 'defaultTheme',
|
||||||
|
_timeout: 1500,
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready( function() {
|
||||||
|
$('body').on('submit', '#form', function(ev){
|
||||||
|
if(checkForm()) return;
|
||||||
|
ev.preventDefault();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
<?php
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
function show() { /* {{{ */
|
||||||
|
$dms = $this->params['dms'];
|
||||||
|
$user = $this->params['user'];
|
||||||
|
$sitename = $this->params['sitename'];
|
||||||
|
|
||||||
|
$this->htmlStartPage(getMLText("2_factor_auth"), "forcepasswordchange");
|
||||||
|
$this->globalNavigation();
|
||||||
|
$this->contentStart();
|
||||||
|
$this->pageNavigation(getMLText("my_account"), "my_account");
|
||||||
|
$this->contentHeading(getMLText('2_factor_auth'));
|
||||||
|
echo "<div class=\"alert\">".getMLText('2_factor_auth_info')."</div>";
|
||||||
|
echo '<div class="row-fluid">';
|
||||||
|
$this->contentContainerStart('span6');
|
||||||
|
|
||||||
|
$tfa = new \RobThree\Auth\TwoFactorAuth('SeedDMS');
|
||||||
|
$oldsecret = $user->getSecret();
|
||||||
|
$secret = $tfa->createSecret();
|
||||||
|
?>
|
||||||
|
<form class="form-horizontal" action="../op/op.Setup2Factor.php" method="post" id="form" name="form1">
|
||||||
|
<div class="control-group"><label class="control-label"><?php printMLText('2_fact_auth_secret'); ?></label><div class="controls">
|
||||||
|
<input id="secret" class="secret" type="text" name="secret" size="30" value="<?php echo $secret; ?>"><br />
|
||||||
|
</div></div>
|
||||||
|
<div class="control-group"><label class="control-label"></label><div class="controls">
|
||||||
|
<img src="<?php echo $tfa->getQRCodeImageAsDataUri($sitename, $secret); ?>">
|
||||||
|
</div></div>
|
||||||
|
<div class="control-group"><label class="control-label"></label><div class="controls">
|
||||||
|
<input class="btn" type="submit" value="<?php printMLText("submit_2_fact_auth") ?>"><br />
|
||||||
|
</div></div>
|
||||||
|
</form>
|
||||||
|
<?php
|
||||||
|
if($oldsecret) {
|
||||||
|
$this->contentContainerEnd();
|
||||||
|
$this->contentContainerStart('span6');
|
||||||
|
echo '<div>'.$oldsecret.'</div>';
|
||||||
|
echo '<div><img src="'.$tfa->getQRCodeImageAsDataUri($sitename, $oldsecret).'"></div>';
|
||||||
|
?>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->contentContainerEnd();
|
||||||
|
echo '</div>';
|
||||||
|
$this->contentEnd();
|
||||||
|
$this->htmlEndPage();
|
||||||
|
} /* }}} */
|
||||||
|
}
|
||||||
|
?>
|
Loading…
Reference in New Issue
Block a user