From e9407ae426a7afd1d846a4c0583853a0d7058e7c Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Tue, 2 Nov 2021 14:48:52 -0700 Subject: [PATCH] fixing as per PR --- lib/cwtch/cwtch.dart | 2 ++ lib/views/addeditprofileview.dart | 4 ++-- lib/views/addeditservers.dart | 6 +++--- lib/views/serversview.dart | 1 - lib/widgets/serverrow.dart | 1 - 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cwtch/cwtch.dart b/lib/cwtch/cwtch.dart index 8ee539fa..5e229b47 100644 --- a/lib/cwtch/cwtch.dart +++ b/lib/cwtch/cwtch.dart @@ -1,5 +1,7 @@ import 'package:flutter/src/services/text_input.dart'; +// To handle profiles that are "unencrypted" (i.e don't require a password to open) we currently create a profile with a defacto, hardcoded password. +// Details: https://docs.openprivacy.ca/cwtch-security-handbook/profile_encryption_and_storage.html const DefaultPassword = "be gay do crime"; abstract class Cwtch { diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index 25e0749b..6b8f1e7c 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -296,12 +296,12 @@ class _AddEditProfileViewState extends State { // Profile Editing if (ctrlrPass.value.text.isEmpty) { // Don't update password, only update name - Provider.of(context, listen: false).cwtch.SetProfileAttribute(Provider.of(context, listen: false).onion, "public.name", ctrlrNick.value.text); + Provider.of(context, listen: false).cwtch.SetProfileAttribute(Provider.of(context, listen: false).onion, "profile.name", ctrlrNick.value.text); Navigator.of(context).pop(); } else { // At this points passwords have been validated to be the same and not empty // Update both password and name, even if name hasn't been changed... - Provider.of(context, listen: false).cwtch.SetProfileAttribute(Provider.of(context, listen: false).onion, "public.name", ctrlrNick.value.text); + Provider.of(context, listen: false).cwtch.SetProfileAttribute(Provider.of(context, listen: false).onion, "profile.name", ctrlrNick.value.text); final updatePasswordEvent = { "EventType": "ChangePassword", "Data": {"Password": ctrlrOldPass.text, "NewPassword": ctrlrPass.text} diff --git a/lib/views/addeditservers.dart b/lib/views/addeditservers.dart index 57cb18d8..63a547a1 100644 --- a/lib/views/addeditservers.dart +++ b/lib/views/addeditservers.dart @@ -138,7 +138,6 @@ class _AddEditServerViewState extends State { } else { Provider.of(context, listen: false).cwtch.StopServer(serverInfoState.onion); } - // ?? serverInfoState.enabled = value; + notify? }, activeTrackColor: settings.theme.defaultButtonActiveColor(), inactiveTrackColor: settings.theme.defaultButtonDisabledColor(), @@ -195,7 +194,8 @@ class _AddEditServerViewState extends State { height: 20, ), Visibility( - visible: usePassword, + // Currently we don't support password change for servers so also gate this on Add server, when ready to support changing password remove the onion.isEmpty check + visible: serverInfoState.onion.isEmpty && usePassword, child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Visibility( visible: serverInfoState.onion.isNotEmpty && serverInfoState.isEncrypted, @@ -323,7 +323,7 @@ class _AddEditServerViewState extends State { if (_formKey.currentState!.validate()) { - // TODO change password + // TODO support change password } Navigator.of(context).pop(); } diff --git a/lib/views/serversview.dart b/lib/views/serversview.dart index a9696df8..84c7e532 100644 --- a/lib/views/serversview.dart +++ b/lib/views/serversview.dart @@ -144,7 +144,6 @@ class _ServersView extends State { providers: [ChangeNotifierProvider( create: (_) => ServerInfoState(onion: "", serverBundle: "", description: "", autoStart: true, running: false, isEncrypted: true), )], - //ChangeNotifierProvider.value(value: Provider.of(context))], child: AddEditServerView(), ); }, diff --git a/lib/widgets/serverrow.dart b/lib/widgets/serverrow.dart index 0588df82..4741195d 100644 --- a/lib/widgets/serverrow.dart +++ b/lib/widgets/serverrow.dart @@ -86,7 +86,6 @@ class _ServerRowState extends State { providers: [ChangeNotifierProvider( create: (_) => server, )], - //ChangeNotifierProvider.value(value: Provider.of(context))], child: AddEditServerView(), ); },