[fix] paste dashboard user check bug

fixes panic caused by token_user check in pages::paste_view::dashboard_request
This commit is contained in:
hkau 2024-04-01 17:58:18 +00:00
parent dd9d5597c9
commit 6e6b15e393
1 changed files with 6 additions and 5 deletions

View File

@ -549,11 +549,12 @@ pub async fn dashboard_request(
set_cookie = "__Secure-Token=refresh; SameSite=Strict; Secure; Path=/; HostOnly=true; HttpOnly=true; Max-Age=0";
token_user = Option::None;
}
} else {
// you must have an account to use atomic pastes
// we'll likely track bandwidth used by atomic pastes and limit it in the future
}
if token_user.is_none() {
// you must have an account to use the user dashboard pastes
return HttpResponse::NotFound().body(
"You must have an account to use atomic pastes.
"You must have an account to use the user dashboard pastes.
You can login at: /d/auth/login
You can create an account at: /d/auth/register",
);
@ -588,6 +589,6 @@ You can create an account at: /d/auth/register",
.append_header(("Content-Type", "text/html"))
.body(format_html(
renderer.render().await,
"<title>Atomic Dashboard - ::SITE_NAME::</title>",
"<title>Paste Dashboard - ::SITE_NAME::</title>",
));
}