diff --git a/packages/neon/neon/lib/src/pages/login.dart b/packages/neon/neon/lib/src/pages/login.dart index e3eaab4f..66e24e47 100644 --- a/packages/neon/neon/lib/src/pages/login.dart +++ b/packages/neon/neon/lib/src/pages/login.dart @@ -200,18 +200,10 @@ class _LoginPageState extends State { ), keyboardType: TextInputType.url, initialValue: widget.serverURL, - validator: (final input) => validateHttpUrl( - context, - input, - allowEmptyScheme: true, - ), + validator: (final input) => validateHttpUrl(context, input), onFieldSubmitted: (final input) { if (_formKey.currentState!.validate()) { - var url = input; - if (!(url.startsWith('http://') || url.startsWith('https://'))) { - url = 'http://$url'; - } - _loginBloc.setServerURL(url); + _loginBloc.setServerURL(input); } else { _focusNode.requestFocus(); } diff --git a/packages/neon/neon/lib/src/utils/validators.dart b/packages/neon/neon/lib/src/utils/validators.dart index 7d691582..6a9e9d1e 100644 --- a/packages/neon/neon/lib/src/utils/validators.dart +++ b/packages/neon/neon/lib/src/utils/validators.dart @@ -4,7 +4,6 @@ String? validateHttpUrl( final BuildContext context, final String? input, { final bool httpsOnly = false, - final bool allowEmptyScheme = false, }) { if (input == null || input == '') { return AppLocalizations.of(context).errorInvalidURL; @@ -15,9 +14,7 @@ String? validateHttpUrl( return null; } if (uri.isScheme('http') && !httpsOnly) { - return null; - } - if (uri.isScheme('') && allowEmptyScheme) { + // TODO: Maybe make a better error message for http URLs if only https is allowed return null; } } catch (_) {}