add validation for login form's server url

This commit is contained in:
Connery Noble
2023-01-14 00:14:09 -08:00
parent 075d603829
commit a485bb2010
20 changed files with 37 additions and 8 deletions
+8
View File
@@ -0,0 +1,8 @@
String sanitizeUrl(String url) {
// Add schema if none is set
final urlWithSchema =
url.startsWith(RegExp(r"https?://")) ? url : "https://$url";
// Remove trailing slash(es)
return urlWithSchema.replaceFirst(RegExp(r"/+$"), "");
}