v0.2.0
This commit is contained in:
1 parent
fc81ecafd6
commit
dc57aa7089
89 files changed
+5290
-1551
No files matched your search
+6
-14
@@ -56,8 +56,7 @@ fn browser_cookie(
|
||||
) -> String {
|
||||
let secure_flag = if secure { " Secure;" } else { "" };
|
||||
format!(
|
||||
"{}={};{} HttpOnly; SameSite={}; Path={}; Max-Age={}",
|
||||
BROWSER_COOKIE, browser_id, secure_flag, same_site, path, max_age_secs
|
||||
"{BROWSER_COOKIE}={browser_id};{secure_flag} HttpOnly; SameSite={same_site}; Path={path}; Max-Age={max_age_secs}"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -71,24 +70,21 @@ fn account_session_cookie(
|
||||
) -> String {
|
||||
let secure_flag = if secure { " Secure;" } else { "" };
|
||||
format!(
|
||||
"rustbox_session_{}={};{} HttpOnly; SameSite={}; Path={}; Max-Age={}",
|
||||
account_id, token, secure_flag, same_site, path, max_age_secs
|
||||
"rustbox_session_{account_id}={token};{secure_flag} HttpOnly; SameSite={same_site}; Path={path}; Max-Age={max_age_secs}"
|
||||
)
|
||||
}
|
||||
|
||||
fn clearing_browser_cookie(secure: bool, same_site: &str, path: &str) -> String {
|
||||
let secure_flag = if secure { " Secure;" } else { "" };
|
||||
format!(
|
||||
"{}=;{} HttpOnly; SameSite={}; Path={}; Max-Age=0",
|
||||
BROWSER_COOKIE, secure_flag, same_site, path
|
||||
"{BROWSER_COOKIE}=;{secure_flag} HttpOnly; SameSite={same_site}; Path={path}; Max-Age=0"
|
||||
)
|
||||
}
|
||||
|
||||
fn clearing_account_cookie(account_id: &str, secure: bool, same_site: &str, path: &str) -> String {
|
||||
let secure_flag = if secure { " Secure;" } else { "" };
|
||||
format!(
|
||||
"rustbox_session_{}=;{} HttpOnly; SameSite={}; Path={}; Max-Age=0",
|
||||
account_id, secure_flag, same_site, path
|
||||
"rustbox_session_{account_id}=;{secure_flag} HttpOnly; SameSite={same_site}; Path={path}; Max-Age=0"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -237,13 +233,9 @@ pub async fn login(
|
||||
}
|
||||
|
||||
let user_hash = user_data::hash_email(&body.email);
|
||||
let provision_result = if config.search_index_backend == "tantivy" {
|
||||
user_data::provision_user_data(&config.data_dir, &user_hash)
|
||||
} else {
|
||||
user_data::provision_user_data_with_search(&config.data_dir, &user_hash, false)
|
||||
};
|
||||
let provision_result = user_data::provision_user_database(&config.data_dir, &user_hash);
|
||||
if let Err(e) = provision_result {
|
||||
tracing::error!(error = %e, "failed to provision user data directory");
|
||||
tracing::error!(error = %e, "failed to provision user database");
|
||||
return (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
[("content-type", "application/json")],
|
||||
|
||||
Reference in new issue
Block a user