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

Commit a14dfc22 authored by Akhil's avatar Akhil 🙂
Browse files

fix: use a setting in the same app for setting up e2ee passwords

parent a24702e3
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ class AccountController extends Controller {
		$csp = $response->getContentSecurityPolicy();
		$setupPasswordsE2ee = false;

		if ($this->appManager->isEnabledForUser(self::PASSWORDS_APP_ID) && $this->config->getAppValue(self::PASSWORDS_APP_ID, 'mandatoryEndToEndEncryption', false)) {
		if ($this->shouldSetupPasswordsE2eeAtSignup()) {
			$setupPasswordsE2ee = true;
			$csp->allowEvalWasm();
		}
@@ -231,7 +231,7 @@ class AccountController extends Controller {
			$this->session->remove(self::CAPTCHA_VERIFIED_CHECK);

			// Session needed for client to setup E2EE at passwords app via API calls
			if ($this->appManager->isEnabledForUser(self::PASSWORDS_APP_ID) && $this->config->getAppValue(self::PASSWORDS_APP_ID, 'mandatoryEndToEndEncryption', false)) {
			if ($this->shouldSetupPasswordsE2eeAtSignup()) {
				$user = $this->userService->getUser($username);
				$this->userSession->setUser($user);
			}
@@ -425,4 +425,8 @@ class AccountController extends Controller {
		return $captchaProvider;
	}

	private function shouldSetupPasswordsE2eeAtSignup() : bool {
		return $this->appManager->isEnabledForUser(self::PASSWORDS_APP_ID) && $this->config->getAppValue(Application::APP_ID, 'setupPasswordsE2eeAtSignup', false);
	}

}