mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-10-26 00:56:47 +02:00
2026.6.0 send support (#7346)
* 2026.6.0 send support * Prevent creating and editing a Send with email verification * Review fixes --------- Co-authored-by: Timshel <timshel@users.noreply.github.com>
This commit is contained in:
1 parent
7320a1db4b
commit
5c5e8e1a6f
6 files changed
+329
-12
No files matched your search
+19
-2
@@ -31,8 +31,8 @@ use crate::{
|
||||
DbConn,
|
||||
models::{
|
||||
AuthRequest, AuthRequestId, Device, DeviceId, EventType, Invitation, OIDCCodeResponseError,
|
||||
OrganizationApiKey, OrganizationId, SsoAuth, SsoUser, TwoFactor, TwoFactorIncomplete, TwoFactorType, User,
|
||||
UserId,
|
||||
OrganizationApiKey, OrganizationId, SendId, SsoAuth, SsoUser, TwoFactor, TwoFactorIncomplete,
|
||||
TwoFactorType, User, UserId,
|
||||
},
|
||||
},
|
||||
error::MapResult,
|
||||
@@ -108,6 +108,19 @@ async fn login(
|
||||
sso_login(data, &mut user_id, &conn, &client_header.ip, client_version.as_ref()).await
|
||||
}
|
||||
"authorization_code" => err!("SSO sign-in is not available"),
|
||||
"send_access" => {
|
||||
check_is_some(data.client_id.as_ref(), "client_id cannot be blank")?;
|
||||
check_is_some(data.send_id.as_ref(), "send_id cannot be blank")?;
|
||||
|
||||
let tokens = auth::SendTokens::generate_tokens(
|
||||
data.send_id.as_ref().unwrap(),
|
||||
data.password_hash_b64,
|
||||
&client_header.ip,
|
||||
&conn,
|
||||
)
|
||||
.await?;
|
||||
Ok(Json(tokens.to_json()))
|
||||
}
|
||||
t => err!("Invalid type", t),
|
||||
};
|
||||
|
||||
@@ -1144,6 +1157,10 @@ struct ConnectData {
|
||||
code: Option<OIDCCode>,
|
||||
#[field(name = uncased("code_verifier"))]
|
||||
code_verifier: Option<OIDCCodeVerifier>,
|
||||
|
||||
// Needed for send access
|
||||
send_id: Option<SendId>,
|
||||
password_hash_b64: Option<String>,
|
||||
}
|
||||
fn check_is_some<T>(value: Option<&T>, msg: &str) -> EmptyResult {
|
||||
if value.is_none() {
|
||||
|
||||
Reference in new issue
Block a user