Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Mattos <vitor@php.rio>2021-10-20 20:45:33 +0300
committerJoas Schilling <coding@schilljs.com>2021-10-23 01:54:50 +0300
commitd613b320451516c466fca7b408414a0193139602 (patch)
treedc7f83af1981e3f45fae66087a496a327f93cfb4 /core/Controller
parentb578a1e8b56f6b3ecf7dee837af6bd8265f9c0b0 (diff)
add check isFairUseOfFreePushService on login
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/LoginController.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index 15ec8365c19..b68f91f986e 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -46,6 +46,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\Defaults;
use OCP\IConfig;
use OCP\IInitialStateService;
+use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\ISession;
@@ -53,6 +54,7 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use OCP\IUserSession;
+use OCP\Notification\IManager;
use OCP\Util;
class LoginController extends Controller {
@@ -81,6 +83,10 @@ class LoginController extends Controller {
private $initialStateService;
/** @var WebAuthnManager */
private $webAuthnManager;
+ /** @var IManager */
+ private $manager;
+ /** @var IL10N */
+ private $l10n;
public function __construct(?string $appName,
IRequest $request,
@@ -94,7 +100,9 @@ class LoginController extends Controller {
Throttler $throttler,
Chain $loginChain,
IInitialStateService $initialStateService,
- WebAuthnManager $webAuthnManager) {
+ WebAuthnManager $webAuthnManager,
+ IManager $manager,
+ IL10N $l10n) {
parent::__construct($appName, $request);
$this->userManager = $userManager;
$this->config = $config;
@@ -107,6 +115,8 @@ class LoginController extends Controller {
$this->loginChain = $loginChain;
$this->initialStateService = $initialStateService;
$this->webAuthnManager = $webAuthnManager;
+ $this->manager = $manager;
+ $this->l10n = $l10n;
}
/**
@@ -153,6 +163,12 @@ class LoginController extends Controller {
}
$loginMessages = $this->session->get('loginMessages');
+ if (!$this->manager->isFairUseOfFreePushService()) {
+ if (!is_array($loginMessages)) {
+ $loginMessages = [[], []];
+ }
+ $loginMessages[1][] = $this->l10n->t('This community release of Nextcloud is unsupported and instant notifications are unavailable.');
+ }
if (is_array($loginMessages)) {
[$errors, $messages] = $loginMessages;
$this->initialStateService->provideInitialState('core', 'loginMessages', $messages);