change in confirm mechanism

This commit is contained in:
Mateusz Gruszczyński
2026-07-28 10:17:45 +02:00
parent d38b5b0b51
commit c8d441fa76
6 changed files with 31 additions and 8 deletions
+1 -1
View File
@@ -103,7 +103,7 @@ pub fn router(
)
.route(
"/share-invitations/{token}/accept",
get(auth::accept_share_invitation),
get(home).post(auth::accept_share_invitation),
)
.route("/api/auth/password-reset", post(auth::request_reset))
.route(
+2 -3
View File
@@ -9,7 +9,6 @@ use axum::{
Json,
extract::{Path as AxumPath, State},
http::{HeaderMap, StatusCode},
response::Redirect,
};
use chrono::{Duration, Utc};
use lettre::{
@@ -1261,7 +1260,7 @@ pub async fn share_resource_users(
pub async fn accept_share_invitation(
State(state): State<SharedState>,
AxumPath(token): AxumPath<String>,
) -> Result<Redirect, AuthError> {
) -> Result<Json<serde_json::Value>, AuthError> {
let token_hash = hash_token(token.trim());
let row: Option<(String, String, i64, String, String, Option<String>)> = sqlx::query_as(
queries::get(state.db.kind(), queries::SHARE_INVITATION_FIND_TOKEN),
@@ -1320,7 +1319,7 @@ pub async fn accept_share_invitation(
} else {
format!("/p/{slug}")
};
Ok(Redirect::to(&target))
Ok(Json(serde_json::json!({"ok": true, "url": target})))
}
pub async fn remove_resource_user(