diff options
-rw-r--r-- | appinfo/app.php | 7 | ||||
-rw-r--r-- | appinfo/info.xml | 4 | ||||
-rw-r--r-- | lib/AppInfo/Application.php (renamed from appinfo/application.php) | 7 | ||||
-rw-r--r-- | lib/Controller/SettingsController.php | 13 | ||||
-rw-r--r-- | lib/Db/TotpSecret.php | 2 | ||||
-rw-r--r-- | lib/Db/TotpSecretMapper.php | 2 | ||||
-rw-r--r-- | lib/Exception/NoTotpSecretFoundException.php | 2 | ||||
-rw-r--r-- | lib/Exception/TotpSecretAlreadySet.php | 2 | ||||
-rw-r--r-- | lib/Provider/TotpProvider.php | 8 | ||||
-rw-r--r-- | lib/Service/ITotp.php | 4 | ||||
-rw-r--r-- | lib/Service/Totp.php | 8 |
11 files changed, 36 insertions, 23 deletions
diff --git a/appinfo/app.php b/appinfo/app.php index 2785625..1055626 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -18,6 +18,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + +use OCA\TwoFactor_Totp\AppInfo\Application; + include_once __DIR__ . '/../vendor/autoload.php'; -\OC_App::registerPersonal('twofactor_totp', 'settings/personal'); +$app = new Application(); + +OC_App::registerPersonal('twofactor_totp', 'settings/personal'); diff --git a/appinfo/info.xml b/appinfo/info.xml index 44d1105..549b609 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -6,14 +6,14 @@ <licence>AGPL</licence> <author>Christoph Wurst</author> <version>0.0.2</version> - <namespace>TwoFactorTotp</namespace> + <namespace>TwoFactor_Totp</namespace> <category>other</category> <types> <authentication/> </types> <two-factor-providers> - <provider>OCA\TwoFactorTotp\Provider\TotpProvider</provider> + <provider>OCA\TwoFactor_Totp\Provider\TotpProvider</provider> </two-factor-providers> <dependencies> diff --git a/appinfo/application.php b/lib/AppInfo/Application.php index f2db909..6c708ed 100644 --- a/appinfo/application.php +++ b/lib/AppInfo/Application.php @@ -19,14 +19,17 @@ * */ -namespace OCA\TwoFactorTotp\AppInfo; +namespace OCA\TwoFactor_Totp\AppInfo; use OCP\AppFramework\App; class Application extends App { public function __construct($urlParams = []) { - parent::__construct('twofactor_totps', $urlParams); + parent::__construct('twofactor_totp', $urlParams); + + $container = $this->getContainer(); + $container->registerAlias('\OCA\TwoFactor_Totp\Service\ITotp', '\OCA\TwoFactor_Totp\Service\Totp'); } } diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php index 466a53b..ef0be0e 100644 --- a/lib/Controller/SettingsController.php +++ b/lib/Controller/SettingsController.php @@ -19,10 +19,9 @@ * */ -namespace OCA\TwoFactorTotp\Controller; +namespace OCA\TwoFactor_Totp\Controller; -use OCA\TwoFactorTotp\Service\ITotp; -use OCA\TwoFactorTotp\Service\Totp; +use OCA\TwoFactor_Totp\Service\ITotp; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; @@ -36,7 +35,13 @@ class SettingsController extends Controller { /** @var IUserSession */ private $userSession; - public function __construct($appName, IRequest $request, IUserSession $userSession, Totp $totp) { + /** + * @param string $appName + * @param IRequest $request + * @param IUserSession $userSession + * @param ITotp $totp + */ + public function __construct($appName, IRequest $request, IUserSession $userSession, ITotp $totp) { parent::__construct($appName, $request); $this->userSession = $userSession; $this->totp = $totp; diff --git a/lib/Db/TotpSecret.php b/lib/Db/TotpSecret.php index 75b06bb..c40814a 100644 --- a/lib/Db/TotpSecret.php +++ b/lib/Db/TotpSecret.php @@ -19,7 +19,7 @@ * */ -namespace OCA\TwoFactorTotp\Db; +namespace OCA\TwoFactor_Totp\Db; use OCP\AppFramework\Db\Entity; diff --git a/lib/Db/TotpSecretMapper.php b/lib/Db/TotpSecretMapper.php index 48d91d2..a142e7c 100644 --- a/lib/Db/TotpSecretMapper.php +++ b/lib/Db/TotpSecretMapper.php @@ -19,7 +19,7 @@ * */ -namespace OCA\TwoFactorTotp\Db; +namespace OCA\TwoFactor_Totp\Db; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Db\Mapper; diff --git a/lib/Exception/NoTotpSecretFoundException.php b/lib/Exception/NoTotpSecretFoundException.php index d8d09a0..0b71efb 100644 --- a/lib/Exception/NoTotpSecretFoundException.php +++ b/lib/Exception/NoTotpSecretFoundException.php @@ -19,7 +19,7 @@ * */ -namespace OCA\TwoFactorTotp\Exception; +namespace OCA\TwoFactor_Totp\Exception; use Exception; diff --git a/lib/Exception/TotpSecretAlreadySet.php b/lib/Exception/TotpSecretAlreadySet.php index b79f33a..18a06bd 100644 --- a/lib/Exception/TotpSecretAlreadySet.php +++ b/lib/Exception/TotpSecretAlreadySet.php @@ -19,7 +19,7 @@ * */ -namespace OCA\TwoFactorTotp\Exception; +namespace OCA\TwoFactor_Totp\Exception; use Exception; diff --git a/lib/Provider/TotpProvider.php b/lib/Provider/TotpProvider.php index f147e3c..dc72331 100644 --- a/lib/Provider/TotpProvider.php +++ b/lib/Provider/TotpProvider.php @@ -19,9 +19,9 @@ * */ -namespace OCA\TwoFactorTotp\Provider; +namespace OCA\TwoFactor_Totp\Provider; -use OCA\TwoFactorTotp\Service\Totp; +use OCA\TwoFactor_Totp\Service\ITotp; use OCP\Authentication\TwoFactorAuth\IProvider; use OCP\IL10N; use OCP\IUser; @@ -29,7 +29,7 @@ use OCP\Template; class TotpProvider implements IProvider { - /** @var Totp */ + /** @var ITotp */ private $totp; /** @var IL10N */ @@ -39,7 +39,7 @@ class TotpProvider implements IProvider { * @param Totp $totp * @param IL10N $l10n */ - public function __construct(Totp $totp, IL10N $l10n) { + public function __construct(ITotp $totp, IL10N $l10n) { $this->totp = $totp; $this->l10n = $l10n; } diff --git a/lib/Service/ITotp.php b/lib/Service/ITotp.php index a389151..5923088 100644 --- a/lib/Service/ITotp.php +++ b/lib/Service/ITotp.php @@ -19,9 +19,9 @@ * */ -namespace OCA\TwoFactorTotp\Service; +namespace OCA\TwoFactor_Totp\Service; -use OCA\TwoFactorTotp\Exception\TotpSecretAlreadySet; +use OCA\TwoFactor_Totp\Exception\TotpSecretAlreadySet; use OCP\IUser; interface ITotp { diff --git a/lib/Service/Totp.php b/lib/Service/Totp.php index d838ad0..ec59ef5 100644 --- a/lib/Service/Totp.php +++ b/lib/Service/Totp.php @@ -19,12 +19,12 @@ * */ -namespace OCA\TwoFactorTotp\Service; +namespace OCA\TwoFactor_Totp\Service; use Base32\Base32; -use OCA\TwoFactorTotp\Db\TotpSecret; -use OCA\TwoFactorTotp\Db\TotpSecretMapper; -use OCA\TwoFactorTotp\Exception\NoTotpSecretFoundException; +use OCA\TwoFactor_Totp\Db\TotpSecret; +use OCA\TwoFactor_Totp\Db\TotpSecretMapper; +use OCA\TwoFactor_Totp\Exception\NoTotpSecretFoundException; use OCP\AppFramework\Db\DoesNotExistException; use OCP\IUser; use OCP\Security\ICrypto; |