@@ -12,6 +12,8 @@ import { I18nContext } from '../contexts/I18nContext'
1212const log = getLogger ( 'renderer/loginForm' )
1313
1414import type { Credentials } from './Settings/DefaultCredentials'
15+ import SettingsStoreInstance , { useSettingsStore } from '../stores/settings'
16+ import Switch from './Switch'
1517
1618const Socket = {
1719 automatic : 'automatic' ,
@@ -42,6 +44,8 @@ export default function LoginForm({
4244 const [ providerInfo , setProviderInfo ] = useState <
4345 Type . ProviderInfo | undefined
4446 > ( )
47+ const settingsStore = useSettingsStore ( ) [ 0 ]
48+ const forceEncryption = settingsStore ?. settings [ 'force_encryption' ] !== '0'
4549
4650 const handleCredentialsChange = (
4751 event : React . ChangeEvent < HTMLInputElement >
@@ -260,7 +264,22 @@ export default function LoginForm({
260264 < option value = { Socket . starttls } > STARTTLS</ option >
261265 < option value = { Socket . plain } > { tx ( 'off' ) } </ option >
262266 </ DeltaSelect >
263-
267+ < div className = 'delta-form-group delta-switch' >
268+ < label >
269+ < span > { tx ( 'enforce_e2ee' ) } </ span >
270+ { /** be aware that this setting applies to all relays! */ }
271+ < Switch
272+ checked = { forceEncryption }
273+ disabled = { settingsStore == null }
274+ onChange = { ( ) =>
275+ SettingsStoreInstance . effect . setCoreSetting (
276+ 'force_encryption' ,
277+ forceEncryption ? '0' : '1'
278+ )
279+ }
280+ />
281+ </ label >
282+ </ div >
264283 < DeltaSelect
265284 id = 'certificateChecks'
266285 label = { tx ( 'login_certificate_checks' ) }
0 commit comments