Compare commits

...

2 commits

Author SHA1 Message Date
95469da4f8
fix 2025-01-12 03:15:13 +01:00
7feae78de0
fix 2025-01-09 22:36:30 +01:00
2 changed files with 3 additions and 3 deletions

View file

@ -15,7 +15,7 @@ impl CSRF for User {
///
/// This is useful for htmx requests to update the CSRF token in place.
async fn update_csrf(&self) -> PreEscaped<String> {
html! { script { (format!("document.querySelectorAll('.csrf').forEach(element => {{ element.value = '{}'; }});", self.get_csrf().await)) }; }
html! { script { (PreEscaped(format!("document.querySelectorAll('.csrf').forEach(element => {{ element.value = '{}'; }});", self.get_csrf().await))) }; }
}
/// Get CSRF Token for the current session

View file

@ -41,7 +41,7 @@ pub trait Sessions {
fn api_key(&self, name: &str) -> impl std::future::Future<Output = Session>;
fn session(&self) -> impl std::future::Future<Output = Session>;
fn list_sessions(&self) -> impl std::future::Future<Output = Vec<Session>>;
fn end_session(&self, id: &str) -> impl std::future::Future<Output = ()>;
fn end_session(&self, id: &uuid::Uuid) -> impl std::future::Future<Output = ()>;
}
impl Sessions for User {
@ -60,7 +60,7 @@ impl Sessions for User {
}
/// End a user session
async fn end_session(&self, id: &str) {
async fn end_session(&self, id: &uuid::Uuid) {
sqlx::query("DELETE FROM user_session WHERE id = $1 AND \"user\" = $2")
.bind(id)
.bind(&self.username)