fix: auth not working when accessed from non-localhost

- Remove hardcoded baseURL from auth-client.ts — better-auth now uses
  current window.location.origin, works from any IP/domain
- Add trustedOrigins config to auth.ts — allows requests from LAN IPs
- Add BETTER_AUTH_TRUSTED_ORIGINS env var for configuring allowed origins
- Improve error logging in login/register forms (was silent catch)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-24 02:54:56 +03:00
parent bd195bd735
commit cbdd2fb2e4
4 changed files with 11 additions and 7 deletions
+3 -2
View File
@@ -25,8 +25,9 @@ export default function LoginPage() {
} else {
router.push("/dashboard");
}
} catch {
setError("Произошла ошибка. Попробуйте ещё раз.");
} catch (err) {
console.error("Login error:", err);
setError(err instanceof Error ? err.message : "Произошла ошибка. Попробуйте ещё раз.");
} finally {
setLoading(false);
}
+3 -2
View File
@@ -26,8 +26,9 @@ export default function RegisterPage() {
} else {
router.push("/dashboard");
}
} catch {
setError("Произошла ошибка. Попробуйте ещё раз.");
} catch (err) {
console.error("Register error:", err);
setError(err instanceof Error ? err.message : "Произошла ошибка. Попробуйте ещё раз.");
} finally {
setLoading(false);
}