forked from cwtch.im/cwtch-ui
fixing as per PR
This commit is contained in:
parent
b65d16aa8a
commit
e9407ae426
|
@ -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 {
|
||||
|
|
|
@ -296,12 +296,12 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
// Profile Editing
|
||||
if (ctrlrPass.value.text.isEmpty) {
|
||||
// Don't update password, only update name
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "public.name", ctrlrNick.value.text);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(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<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "public.name", ctrlrNick.value.text);
|
||||
Provider.of<FlwtchState>(context, listen: false).cwtch.SetProfileAttribute(Provider.of<ProfileInfoState>(context, listen: false).onion, "profile.name", ctrlrNick.value.text);
|
||||
final updatePasswordEvent = {
|
||||
"EventType": "ChangePassword",
|
||||
"Data": {"Password": ctrlrOldPass.text, "NewPassword": ctrlrPass.text}
|
||||
|
|
|
@ -138,7 +138,6 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
} else {
|
||||
Provider.of<FlwtchState>(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<AddEditServerView> {
|
|||
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: <Widget>[
|
||||
Visibility(
|
||||
visible: serverInfoState.onion.isNotEmpty && serverInfoState.isEncrypted,
|
||||
|
@ -323,7 +323,7 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
|
||||
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// TODO change password
|
||||
// TODO support change password
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
|
|
@ -144,7 +144,6 @@ class _ServersView extends State<ServersView> {
|
|||
providers: [ChangeNotifierProvider<ServerInfoState>(
|
||||
create: (_) => ServerInfoState(onion: "", serverBundle: "", description: "", autoStart: true, running: false, isEncrypted: true),
|
||||
)],
|
||||
//ChangeNotifierProvider.value(value: Provider.of<ServerInfoState>(context))],
|
||||
child: AddEditServerView(),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -86,7 +86,6 @@ class _ServerRowState extends State<ServerRow> {
|
|||
providers: [ChangeNotifierProvider<ServerInfoState>(
|
||||
create: (_) => server,
|
||||
)],
|
||||
//ChangeNotifierProvider.value(value: Provider.of<ServerInfoState>(context))],
|
||||
child: AddEditServerView(),
|
||||
);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue