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

github.com/nextcloud/lookup-server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-10-11 17:27:56 +0300
committerGitHub <noreply@github.com>2019-10-11 17:27:56 +0300
commitacb0450de1508d441c6fda9df80dde4c0ae0e9c6 (patch)
tree2d3974b38392da82ae2506ffa65c9abc8a09f0ac
parent376950f39f6875f43768fc6d2e07a7a91dcbf7ba (diff)
parent9d27dcb5ee9427b40fd14d52b03aba07b0083c65 (diff)
Merge pull request #38 from nextcloud/fix/never_email_in_gsv0.3.2
Never e-mail in GS mode
-rw-r--r--server/lib/UserManager.php4
-rw-r--r--server/lib/Validator/Email.php14
-rw-r--r--server/src/dependencies.php3
3 files changed, 16 insertions, 5 deletions
diff --git a/server/lib/UserManager.php b/server/lib/UserManager.php
index 93497c4..9739ee0 100644
--- a/server/lib/UserManager.php
+++ b/server/lib/UserManager.php
@@ -258,7 +258,7 @@ LIMIT :limit');
$storeId = $this->db->lastInsertId();
$stmt->closeCursor();
- if ($field === 'email' && $this->globalScaleMode === false) {
+ if ($field === 'email') {
$this->emailValidator->emailUpdated($data[$field], $storeId);
}
}
@@ -308,7 +308,7 @@ LIMIT :limit');
$stmt->bindParam(':v', $data[$key]);
$stmt->execute();
$stmt->closeCursor();
- if ($key === 'email' && $this->globalScaleMode === false) {
+ if ($key === 'email') {
$this->emailValidator->emailUpdated($data[$key], $row['id']);
}
// remove verification request from old data
diff --git a/server/lib/Validator/Email.php b/server/lib/Validator/Email.php
index 3f0839f..2d82fd0 100644
--- a/server/lib/Validator/Email.php
+++ b/server/lib/Validator/Email.php
@@ -19,22 +19,27 @@ class Email {
/** @var string */
private $from;
+ /** @var bool */
+ private $globalScale;
+
/**
* Email constructor.
* @param \PDO $db
* @param \Slim\Interfaces\RouterInterface $router
* @param string $host
* @param string $from
+ * @param bool $globalScale
*/
public function __construct(\PDO $db,
\Slim\Interfaces\RouterInterface $router,
$host,
- $from) {
+ $from,
+ $globalScale) {
$this->db = $db;
$this->router = $router;
$this->host = $host;
$this->from = $from;
-
+ $this->globalScale = $globalScale;
}
public function validate(Request $request, Response $response) {
@@ -69,6 +74,11 @@ class Email {
}
public function emailUpdated($email, $storeId) {
+ if ($this->globalScale) {
+ // When in global scale mode we should not send e-mails
+ return;
+ }
+
// Delete old tokens
$stmt = $this->db->prepare('DELETE FROM emailValidation WHERE storeId = :storeId');
$stmt->bindParam(':storeId', $storeId);
diff --git a/server/src/dependencies.php b/server/src/dependencies.php
index 641968a..4716a45 100644
--- a/server/src/dependencies.php
+++ b/server/src/dependencies.php
@@ -29,7 +29,8 @@ $container['EmailValidator'] = function($c) {
$c->db,
$c->router,
$c->settings['host'],
- $c->settings['emailfrom']
+ $c->settings['emailfrom'],
+ $c['settings']['global_scale']
);
};
$container['WebsiteValidator'] = function($c) {