Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2018-02-05 15:14:45 +01:00
commit dacacde524
4 changed files with 7 additions and 17 deletions

View File

@ -507,7 +507,7 @@ switch($command) {
case 'submittranslation': /* {{{ */
if($settings->_showMissingTranslations) {
if($user && !empty($_POST['phrase'])) {
if($fp = fopen('/tmp/newtranslations.txt', 'a+')) {
if($fp = fopen($settings->_cacheDir.'/newtranslations.txt', 'a+')) {
fputcsv($fp, array(date('Y-m-d H:i:s'), $user->getLogin(), $_POST['key'], $_POST['lang'], $_POST['phrase']));
fclose($fp);
}

View File

@ -132,13 +132,7 @@ if ($user->isAdmin() && ($_SERVER['REMOTE_ADDR'] != $settings->_adminIP ) && ( $
if($settings->_enable2FactorAuthentication) {
if($secret = $user->getSecret()) {
require "vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php";
require "vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php";
require "vendor/robthree/twofactorauth/lib/TwoFactorAuth.php";
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"));

View File

@ -28,6 +28,7 @@ if ($user->isGuest()) {
}
if($view) {
$view->setParam('sitename', $settings->_siteName);
$view->setParam('enable2factauth', $settings->_enable2FactorAuthentication);
$view->setParam('accessobject', $accessop);
$view($_GET);

View File

@ -19,13 +19,7 @@ require_once("class.Bootstrap.php");
/**
* Include classes for 2-factor authentication
*/
require "vendor/robthree/twofactorauth/lib/Providers/Qr/IQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Qr/BaseHTTPQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Qr/GoogleQRCodeProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Rng/IRNGProvider.php";
require "vendor/robthree/twofactorauth/lib/Providers/Rng/MCryptRNGProvider.php";
require "vendor/robthree/twofactorauth/lib/TwoFactorAuthException.php";
require "vendor/robthree/twofactorauth/lib/TwoFactorAuth.php";
require "vendor/autoload.php";
/**
* Class which outputs the html page for ForcePasswordChange view
@ -75,6 +69,7 @@ $(document).ready( function() {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$sitename = $this->params['sitename'];
$this->htmlStartPage(getMLText("2_factor_auth"), "forcepasswordchange");
$this->globalNavigation();
@ -94,7 +89,7 @@ $(document).ready( function() {
<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('My label', $secret); ?>">
<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 />
@ -105,7 +100,7 @@ $(document).ready( function() {
$this->contentContainerEnd();
$this->contentContainerStart('span6');
echo '<div>'.$oldsecret.'</div>';
echo '<div><img src="'.$tfa->getQRCodeImageAsDataUri('My label', $oldsecret).'"></div>';
echo '<div><img src="'.$tfa->getQRCodeImageAsDataUri($sitename, $oldsecret).'"></div>';
?>
<?php
}