diff --git a/src/feather_icons.rs b/src/feather_icons.rs
index 7d60ca8..de31277 100644
--- a/src/feather_icons.rs
+++ b/src/feather_icons.rs
@@ -2,7 +2,10 @@
// feather icons
pub const FEATHER_ICON_USER_PLUS: &str = r#""#;
-#[allow(dead_code)]
pub const FEATHER_ICON_LAYOUT: &str = r#""#;
pub const FEATHER_ICON_LOGIN: &str = r#""#;
+
+pub const FEATHER_ICON_USER: &str = r#""#;
+
+// pub const FEATHER_ICON_: &str = r#""#;
diff --git a/src/partials.rs b/src/partials.rs
index c92f36a..e3b6743 100644
--- a/src/partials.rs
+++ b/src/partials.rs
@@ -1,8 +1,10 @@
+use axum_login::AuthSession;
use maud::{html, Markup, PreEscaped, DOCTYPE};
-use crate::feather_icons;
+use crate::{feather_icons, state};
-pub fn header() -> Markup {
+pub fn header(sess: &AuthSession) -> Markup {
+ let is_logged_in = sess.user.is_some();
html! {
(DOCTYPE)
head {
@@ -27,13 +29,24 @@ pub fn header() -> Markup {
// (PreEscaped(FEATHER_ICON_LAYOUT))
// "Dashboard"
// }
- a href="/register" preload="" {
- (PreEscaped(feather_icons::FEATHER_ICON_USER_PLUS))
- "Register"
- }
- a href="/login" preload="" {
- (PreEscaped(feather_icons::FEATHER_ICON_LOGIN))
- "Login"
+ @if is_logged_in {
+ a href="/account" preload="" {
+ (PreEscaped(feather_icons::FEATHER_ICON_USER))
+ "Account"
+ }
+ a href="/app" preload="" {
+ (PreEscaped(feather_icons::FEATHER_ICON_LAYOUT))
+ "Dashboard"
+ }
+ } @else {
+ a href="/register" preload="" {
+ (PreEscaped(feather_icons::FEATHER_ICON_USER_PLUS))
+ "Register"
+ }
+ a href="/login" preload="" {
+ (PreEscaped(feather_icons::FEATHER_ICON_LOGIN))
+ "Login"
+ }
}
}
}
diff --git a/src/router.rs b/src/router.rs
index 558f9cd..18be87a 100644
--- a/src/router.rs
+++ b/src/router.rs
@@ -114,7 +114,7 @@ where
{
let password_bytes = password.as_ref().as_bytes();
let current = PasswordHash::new(current_digest.as_ref())?;
- Ok(Argon2::default().verify_password(password_bytes, ¤t)?)
+ Argon2::default().verify_password(password_bytes, ¤t)
}
impl user::ActiveModel {}
@@ -170,18 +170,16 @@ impl AuthnBackend for state::State {
type Error = AppError;
async fn authenticate(&self, l: Self::Credentials) -> Result