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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user