Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-11-04 02:18:00 +01:00
make error toast display detailed message
replace invite accept error message with the one from upstream check if config mail is enabled
Dieser Commit ist enthalten in:
Ursprung
d75a80bd2d
Commit
1db37bf3d0
3 geänderte Dateien mit 13 neuen und 11 gelöschten Zeilen
|
@ -656,10 +656,8 @@ fn accept_invite(_org_id: String, _org_user_id: String, data: JsonUpcase<AcceptD
|
||||||
};
|
};
|
||||||
|
|
||||||
if org_twofactor_policy_enabled && user_twofactor_disabled {
|
if org_twofactor_policy_enabled && user_twofactor_disabled {
|
||||||
let org = Organization::find_by_uuid(&org, &conn).unwrap();
|
|
||||||
// you haven't joined yet, but mail explains why you were unable to accept invitation
|
err!("You cannot join this organization until you enable two-step login on your user account.")
|
||||||
mail::send_2fa_removed_from_org(&claims.email, &org.name)?;
|
|
||||||
err!("Organization policy requires that you enable two Two-step Login begin joining.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user_org.status = UserOrgStatus::Accepted as i32;
|
user_org.status = UserOrgStatus::Accepted as i32;
|
||||||
|
@ -1021,10 +1019,12 @@ fn put_policy(org_id: String, pol_type: i32, data: Json<PolicyData>, _headers: A
|
||||||
|
|
||||||
if user_twofactor_disabled && user_org.atype < UserOrgType::Admin {
|
if user_twofactor_disabled && user_org.atype < UserOrgType::Admin {
|
||||||
|
|
||||||
let org = Organization::find_by_uuid(&user_org.org_uuid, &conn).unwrap();
|
if CONFIG.mail_enabled() {
|
||||||
let user = User::find_by_uuid(&user_org.user_uuid, &conn).unwrap();
|
let org = Organization::find_by_uuid(&user_org.org_uuid, &conn).unwrap();
|
||||||
|
let user = User::find_by_uuid(&user_org.user_uuid, &conn).unwrap();
|
||||||
|
|
||||||
mail::send_2fa_removed_from_org(&user.email, &org.name)?;
|
mail::send_2fa_removed_from_org(&user.email, &org.name)?;
|
||||||
|
}
|
||||||
user_org.delete(&conn)?;
|
user_org.delete(&conn)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ use crate::{
|
||||||
models::*,
|
models::*,
|
||||||
DbConn,
|
DbConn,
|
||||||
},
|
},
|
||||||
mail,
|
mail, CONFIG,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub mod authenticator;
|
pub mod authenticator;
|
||||||
|
@ -144,9 +144,11 @@ fn disable_twofactor(data: JsonUpcase<DisableTwoFactorData>, headers: Headers, c
|
||||||
for user_org in org_list.into_iter() {
|
for user_org in org_list.into_iter() {
|
||||||
|
|
||||||
if user_org.atype < UserOrgType::Admin {
|
if user_org.atype < UserOrgType::Admin {
|
||||||
let org = Organization::find_by_uuid(&user_org.org_uuid, &conn).unwrap();
|
|
||||||
|
|
||||||
mail::send_2fa_removed_from_org(&user.email, &org.name)?;
|
if CONFIG.mail_enabled() {
|
||||||
|
let org = Organization::find_by_uuid(&user_org.org_uuid, &conn).unwrap();
|
||||||
|
mail::send_2fa_removed_from_org(&user.email, &org.name)?;
|
||||||
|
}
|
||||||
user_org.delete(&conn)?;
|
user_org.delete(&conn)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ fn _serialize(e: &impl serde::Serialize, _msg: &str) -> String {
|
||||||
|
|
||||||
fn _api_error(_: &impl std::any::Any, msg: &str) -> String {
|
fn _api_error(_: &impl std::any::Any, msg: &str) -> String {
|
||||||
let json = json!({
|
let json = json!({
|
||||||
"Message": "",
|
"Message": msg,
|
||||||
"error": "",
|
"error": "",
|
||||||
"error_description": "",
|
"error_description": "",
|
||||||
"ValidationErrors": {"": [ msg ]},
|
"ValidationErrors": {"": [ msg ]},
|
||||||
|
|
Laden …
In neuem Issue referenzieren