mobile2: Casdoor OIDC auth deployment
- New branch for mobile2.falah-os.com with Casdoor OIDC - Auth page with 'Sign in with Casdoor' button - OIDC callback: exchanges code via server-side API route - env vars configured on Netlify - DNS auto-configured via Netlify (falah-os.com zone)
This commit is contained in:
+26
-1
@@ -3,9 +3,18 @@
|
||||
import { Suspense, useState, FormEvent, useEffect } from "react";
|
||||
import { useAuth } from "@/lib/AuthContext";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import { Mail, ArrowLeft } from "lucide-react";
|
||||
import { Mail, ArrowLeft, Shield } from "lucide-react";
|
||||
import ErrorFeedback from "@/components/ErrorFeedback";
|
||||
|
||||
const getCasdoorUrl = () => {
|
||||
const state = Math.random().toString(36).slice(2, 10);
|
||||
const base = process.env.NEXT_PUBLIC_CASDOOR_SERVER_URL || "https://auth.falahos.my";
|
||||
const clientId = process.env.NEXT_PUBLIC_CASDOOR_CLIENT_ID || "272f91105da5cf984773";
|
||||
const redirect = process.env.NEXT_PUBLIC_CASDOOR_REDIRECT_URI ||
|
||||
"https://mobile2.falah-os.com/auth/callback";
|
||||
return `${base}/login/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=openid+profile+email&state=${state}`;
|
||||
};
|
||||
|
||||
type AuthMode = "login" | "register";
|
||||
type PageState = "select" | "email-form";
|
||||
|
||||
@@ -89,6 +98,22 @@ function AuthPageInner() {
|
||||
|
||||
{/* Sign-in Methods */}
|
||||
<div className="space-y-3">
|
||||
{/* Casdoor OIDC */}
|
||||
<a
|
||||
href={getCasdoorUrl()}
|
||||
className="w-full flex items-center gap-4 px-5 py-4 rounded-2xl bg-green-900/20 border border-green-600/30 active:bg-green-900/30 transition-all touch-manipulation"
|
||||
>
|
||||
<div className="w-6 h-6 shrink-0 flex items-center justify-center">
|
||||
<Shield size={22} className="text-green-400" />
|
||||
</div>
|
||||
<div className="text-left">
|
||||
<span className="text-sm font-medium text-green-400 block">
|
||||
Sign in with Casdoor
|
||||
</span>
|
||||
<span className="text-xs text-gray-600">FalahOS Identity Service</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
{/* Email */}
|
||||
<button
|
||||
onClick={handleEmailClick}
|
||||
|
||||
Reference in New Issue
Block a user