summaryrefslogtreecommitdiffstats
path: root/lib/private/Authentication
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Authentication')
-rw-r--r--lib/private/Authentication/Exceptions/PasswordLoginForbiddenException.php29
-rw-r--r--lib/private/Authentication/Token/DefaultTokenMapper.php1
-rw-r--r--lib/private/Authentication/TwoFactorAuth/Manager.php13
3 files changed, 43 insertions, 0 deletions
diff --git a/lib/private/Authentication/Exceptions/PasswordLoginForbiddenException.php b/lib/private/Authentication/Exceptions/PasswordLoginForbiddenException.php
new file mode 100644
index 00000000000..2e9f9534dbd
--- /dev/null
+++ b/lib/private/Authentication/Exceptions/PasswordLoginForbiddenException.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @author Christoph Wurst <christoph@owncloud.com>
+ *
+ * @copyright Copyright (c) 2016, ownCloud, Inc.
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+namespace OC\Authentication\Exceptions;
+
+use Exception;
+
+class PasswordLoginForbiddenException extends Exception {
+
+}
diff --git a/lib/private/Authentication/Token/DefaultTokenMapper.php b/lib/private/Authentication/Token/DefaultTokenMapper.php
index c56a513b94c..9450ed6b9f3 100644
--- a/lib/private/Authentication/Token/DefaultTokenMapper.php
+++ b/lib/private/Authentication/Token/DefaultTokenMapper.php
@@ -77,6 +77,7 @@ class DefaultTokenMapper extends Mapper {
->execute();
$data = $result->fetch();
+ $result->closeCursor();
if ($data === false) {
throw new DoesNotExistException('token does not exist');
}
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php
index 805735bd1b8..6ca4fd065a6 100644
--- a/lib/private/Authentication/TwoFactorAuth/Manager.php
+++ b/lib/private/Authentication/TwoFactorAuth/Manager.php
@@ -24,6 +24,7 @@ namespace OC\Authentication\TwoFactorAuth;
use Exception;
use OC;
use OC\App\AppManager;
+use OC_App;
use OCP\AppFramework\QueryException;
use OCP\Authentication\TwoFactorAuth\IProvider;
use OCP\IConfig;
@@ -110,6 +111,7 @@ class Manager {
$providerClasses = $info['two-factor-providers'];
foreach ($providerClasses as $class) {
try {
+ $this->loadTwoFactorApp($appId);
$provider = OC::$server->query($class);
$providers[$provider->getId()] = $provider;
} catch (QueryException $exc) {
@@ -126,6 +128,17 @@ class Manager {
}
/**
+ * Load an app by ID if it has not been loaded yet
+ *
+ * @param string $appId
+ */
+ protected function loadTwoFactorApp($appId) {
+ if (!OC_App::isAppLoaded($appId)) {
+ OC_App::loadApp($appId);
+ }
+ }
+
+ /**
* Verify the given challenge
*
* @param string $providerId