From 192a7e0d7ec3b4d487d8f083527cdd317a962dc0 Mon Sep 17 00:00:00 2001
From: Ahmad Mujahid <55625580+AhmadMuj@users.noreply.github.com>
Date: Sun, 9 Feb 2025 15:18:01 +0400
Subject: feat: add URL protocol validation to extension and mobile app (#996)

---
 apps/mobile/app/signin.tsx | 13 +++++++++++++
 1 file changed, 13 insertions(+)

(limited to 'apps/mobile/app/signin.tsx')

diff --git a/apps/mobile/app/signin.tsx b/apps/mobile/app/signin.tsx
index 31cb1e01..17a2158d 100644
--- a/apps/mobile/app/signin.tsx
+++ b/apps/mobile/app/signin.tsx
@@ -84,6 +84,19 @@ export default function Signin() {
   }
 
   const onSignin = () => {
+    if (!formState.serverAddress) {
+      setError("Server address is required");
+      return;
+    }
+
+    if (
+      !formState.serverAddress.startsWith("http://") &&
+      !formState.serverAddress.startsWith("https://")
+    ) {
+      setError("Server address must start with http:// or https://");
+      return;
+    }
+
     if (loginType === LoginType.Password) {
       const randStr = (Math.random() + 1).toString(36).substring(5);
       login({
-- 
cgit v1.3-1-g0d28

