Skip to content
Clone
b453d5d
24 lines 458 B Rust
use crate::extract::Session;
#[derive(Debug, Clone)]
pub struct AuthUser {
pub uid: i64,
pub username: String,
pub display_name: Option<String>,
pub avatar_url: Option<String>,
pub email: String,
}
pub trait SessionUser {
fn uid(&self) -> Option<i64>;
fn is_authenticated(&self) -> bool {
self.uid().is_some()
}
}
impl SessionUser for Session {
fn uid(&self) -> Option<i64> {
Session::uid(self)
}
}