Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 360dd783 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

updated password patch to check defaultE2eeFlowEnabled

parent 6bbcc0b3
Loading
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -19,13 +19,31 @@ Subject: [PATCH] Hide password settings section when encryption is enabled
 		private IUserManager $userManager,
 		private ?string $userId,
 	) {
@@ -33,6 +35,9 @@
@@ -33,10 +35,25 @@
 	}
 
 	public function getSection(): string {
+		if ($this->config->getSystemValueBool('password_encrypt_enabled', false)) {
+		if ($this->shouldHideCorePasswordPanel()) {
+			return null;
+		}
 		return 'security';
 	}
 
 	public function getPriority(): int {
 		return 10;
+	}
+
+	private function shouldHideCorePasswordPanel(): bool {
+		if ($this->userId === null) {
+			return false;
+		}
+
+		if (!$this->config->getSystemValueBool('password_encrypt_enabled', false)) {
+			return false;
+		}
+
+		return $this->config->getUserValue($this->userId, 'passwords', 'defaultE2eeFlowEnabled', '0') !== '1';
 	}
 }
\ No newline at end of file