Resolves #549 trim spaces for device name, url and long-lived token
This commit is contained in:
parent
12ba5598e4
commit
8221eceb78
@ -44,7 +44,6 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_saveSettings() async {
|
_saveSettings() async {
|
||||||
_homeAssistantUrl = _homeAssistantUrl.trim();
|
|
||||||
String socketProtocol;
|
String socketProtocol;
|
||||||
String domain;
|
String domain;
|
||||||
String port;
|
String port;
|
||||||
@ -96,10 +95,10 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
onSaved: (newValue) {
|
onSaved: (newValue) {
|
||||||
_homeAssistantUrl = newValue;
|
_homeAssistantUrl = newValue.trim();
|
||||||
},
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value.isEmpty) {
|
if (value.trim().isEmpty) {
|
||||||
return 'Url is required';
|
return 'Url is required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -138,7 +137,7 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
|
|||||||
TextFormField(
|
TextFormField(
|
||||||
initialValue: _deviceName,
|
initialValue: _deviceName,
|
||||||
onSaved: (newValue) {
|
onSaved: (newValue) {
|
||||||
_deviceName = newValue;
|
_deviceName = newValue.trim();
|
||||||
},
|
},
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: 'Please enter device name',
|
hintText: 'Please enter device name',
|
||||||
@ -148,7 +147,7 @@ class _ConnectionSettingsPageState extends State<ConnectionSettingsPage> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value.isEmpty) {
|
if (value.trim().isEmpty) {
|
||||||
return 'Device name is required';
|
return 'Device name is required';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -74,7 +74,7 @@ class TokenLoginPopup extends Popup {
|
|||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
onSaved: (newValue) {
|
onSaved: (newValue) {
|
||||||
final storage = new FlutterSecureStorage();
|
final storage = new FlutterSecureStorage();
|
||||||
storage.write(key: "hacl_llt", value: newValue).then((_) {
|
storage.write(key: "hacl_llt", value: newValue.trim()).then((_) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
eventBus.fire(SettingsChangedEvent(true));
|
eventBus.fire(SettingsChangedEvent(true));
|
||||||
});
|
});
|
||||||
@ -87,7 +87,7 @@ class TokenLoginPopup extends Popup {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value.isEmpty) {
|
if (value.trim().isEmpty) {
|
||||||
return 'Long-lived token can\'t be emty';
|
return 'Long-lived token can\'t be emty';
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Reference in New Issue
Block a user