Add sign on page #12

Merged
meraghon merged 9 commits from feature/sign-on-page into main 2025-10-16 16:19:24 +00:00
Showing only changes of commit ade13e711f - Show all commits
+19 -5
View File
@@ -1,20 +1,34 @@
use leptos::leptos_dom::logging::console_log;
use leptos::prelude::*; use leptos::prelude::*;
use leptos_oidc::{LoginLink}; use leptos_oidc::{AuthSignal};
use crate::components::ActionButton; use crate::components::ActionButton;
#[component] #[component]
pub fn UnauthenticatedPage() -> impl IntoView { pub fn UnauthenticatedPage() -> impl IntoView {
let auth = use_context::<AuthSignal>().expect("AuthSignal not present in LoginLink");
let login_url = move || {
auth.with(|auth| {
auth.unauthenticated()
.map(|unauthenticated| unauthenticated.login_url())
})
};
let navigate = leptos_router::hooks::use_navigate();
view! ( view! (
<div class="flex h-screen justify-center items-center pb-50"> <div class="flex h-screen justify-center items-center pb-50">
<div class="bg-white p-8 border rounded-lg shadow-lg"> <div class="bg-white p-8 border rounded-lg shadow-lg">
<h3> "You're not signed in. Please sign in with your Region 15 email." </h3> <h3> "You're not signed in. Please sign in with your Region 15 email." </h3>
<div class="flex pt-4 justify-center items-center"> <div class="flex pt-4 justify-center items-center">
<LoginLink class="text-login"> <ActionButton on:click=move |_| {
<ActionButton> "Sign in" </ActionButton> if let Some(url) = login_url() {
</LoginLink> navigate(&url, Default::default())
}
}>
"Sign in"
</ActionButton>
</div> </div>
</div> </div>
</div> </div>
) )
} }