diff --git a/appinfo/app.php b/appinfo/app.php
deleted file mode 100644
index 8ed3342..0000000
--- a/appinfo/app.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
- * @copyright Pellaeon Lin 2014
- */
-
-\OCP\Util::addStyle('registration', 'register-button');
-\OC_App::registerLogIn([
- 'name' => \OC::$server->getL10N('registration')->t('Register'),
- 'href' => \OC::$server->getURLGenerator()->linkToRoute('registration.register.askEmail'),
- 'style' => 'register-button',
-]);
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 052bb41..7194554 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -37,10 +37,7 @@ Send BTC to `33pStaSaf4sDUA8XBAHTq7ZDQpCVFQArxQ`
https://github.com/nextcloud/registration
https://raw.githubusercontent.com/nextcloud/registration/master/appinfo/screenshot.png
- sqlite
- pgsql
- mysql
-
+
OCA\Registration\Settings\RegistrationSettings
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index fd82a0d..d07b8da 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,4 +1,6 @@
*
@@ -24,18 +26,24 @@
namespace OCA\Registration\AppInfo;
use OCA\Registration\Capabilities;
+use OCA\Registration\RegistrationLoginOption;
use OCP\AppFramework\App;
-use OC\Authentication\Token\IProvider;
+use OCP\AppFramework\Bootstrap\IBootContext;
+use OCP\AppFramework\Bootstrap\IBootstrap;
+use OCP\AppFramework\Bootstrap\IRegistrationContext;
+
+class Application extends App implements IBootstrap {
+ public const APP_ID = 'registration';
-class Application extends App {
public function __construct() {
- parent::__construct('registration');
+ parent::__construct(self::APP_ID);
+ }
- $container = $this->getContainer();
- $container->registerService(IProvider::class, function ($c) {
- return \OC::$server->query(IProvider::class); // TODO needed?
- });
+ public function register(IRegistrationContext $context): void {
+ $context->registerAlternativeLogin(RegistrationLoginOption::class);
+ $context->registerCapability(Capabilities::class);
+ }
- $container->registerCapability(Capabilities::class);
+ public function boot(IBootContext $context): void {
}
}
diff --git a/lib/RegistrationLoginOption.php b/lib/RegistrationLoginOption.php
new file mode 100644
index 0000000..d436574
--- /dev/null
+++ b/lib/RegistrationLoginOption.php
@@ -0,0 +1,60 @@
+
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see .
+ *
+ */
+
+namespace OCA\Registration;
+
+use OCA\Registration\AppInfo\Application;
+use OCP\Authentication\IAlternativeLogin;
+use OCP\IL10N;
+use OCP\IURLGenerator;
+use OCP\Util;
+
+class RegistrationLoginOption implements IAlternativeLogin {
+
+ /** @var IURLGenerator */
+ protected $url;
+ /** @var IL10N */
+ protected $l;
+
+ public function __construct(IURLGenerator $url,
+ IL10N $l) {
+ $this->url = $url;
+ $this->l = $l;
+ }
+
+ public function getLabel(): string {
+ return $this->l->t('Register');
+ }
+
+ public function getLink(): string {
+ return $this->url->linkToRoute('registration.register.askEmail');
+ }
+
+ public function getClass(): string {
+ return 'register-button';
+ }
+
+ public function load(): void {
+ Util::addStyle(Application::APP_ID, 'register-button');
+ }
+}