diff options
author | Vika <vika@fireburn.ru> | 2024-08-18 00:30:15 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2024-08-18 00:30:15 +0300 |
commit | e43313210269b8e48fe35b17ac416c9ba88ae4f3 (patch) | |
tree | 51941c5149351bb32260fb8cbd4293eed80563e0 /templates/src/templates.rs | |
parent | cd8029a930b966225d0a57afb1ee29808fe2a409 (diff) | |
download | kittybox-e43313210269b8e48fe35b17ac416c9ba88ae4f3.tar.zst |
feat: logins!!
yes you can finally sign in this is also supposed to show private posts intended for you! maybe i can also reveal my email to those who sign in! :3
Diffstat (limited to 'templates/src/templates.rs')
-rw-r--r-- | templates/src/templates.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/templates/src/templates.rs b/templates/src/templates.rs index 4f7970c..3d22eac 100644 --- a/templates/src/templates.rs +++ b/templates/src/templates.rs @@ -1,10 +1,9 @@ use http::StatusCode; use kittybox_util::MicropubChannel; - use crate::{Feed, VCard}; markup::define! { - Template<'a>(title: &'a str, blog_name: &'a str, feeds: Vec<MicropubChannel>, user: Option<String>, content: String) { + Template<'a>(title: &'a str, blog_name: &'a str, feeds: Vec<MicropubChannel>, user: Option<&'a kittybox_indieauth::ProfileUrl>, content: String) { @markup::doctype() html { head { @@ -41,12 +40,18 @@ markup::define! { li { a[href=&feed.uid] { @feed.name } } } li.shiftright { - @if user.is_none() { - a #login[href="/login/start"] { "Sign in" } - } else { + @if let Some(user) = &user { span { - @user.as_ref().unwrap() " - " a #logout[href="/logout"] { "Sign out" } + @if let Some(kittybox_indieauth::Profile { name: Some(name), photo, .. }) = &user.profile { + a[href=user.me.as_str()] { @name } + } else { + @user.me.as_str() + } + " - " + a #logout[href="/.kittybox/login/logout"] { "Sign out" } } + } else { + a #login[href="/.kittybox/login/start"] { "Sign in" } } } } |