mirror of
https://github.com/dani-garcia/vaultwarden
synced 2024-11-26 05:40:18 +00:00
Update some function calls to use ?
This commit is contained in:
parent
c259a0e3e2
commit
d420992f8c
2 changed files with 4 additions and 4 deletions
|
@ -690,7 +690,7 @@ fn post_attachment(uuid: String, data: Data, content_type: &ContentType, headers
|
||||||
|
|
||||||
let mut attachment = Attachment::new(file_name, cipher.uuid.clone(), name, size);
|
let mut attachment = Attachment::new(file_name, cipher.uuid.clone(), name, size);
|
||||||
attachment.key = attachment_key.clone();
|
attachment.key = attachment_key.clone();
|
||||||
attachment.save(&conn).expect("Error saving attachment");
|
attachment.save(&conn)?;
|
||||||
}
|
}
|
||||||
_ => error!("Invalid multipart name"),
|
_ => error!("Invalid multipart name"),
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ fn recover(data: JsonUpcase<RecoverTwoFactor>, conn: DbConn) -> JsonResult {
|
||||||
|
|
||||||
// Remove all twofactors from the user
|
// Remove all twofactors from the user
|
||||||
for twofactor in TwoFactor::find_by_user(&user.uuid, &conn) {
|
for twofactor in TwoFactor::find_by_user(&user.uuid, &conn) {
|
||||||
twofactor.delete(&conn).expect("Error deleting twofactor");
|
twofactor.delete(&conn)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the recovery code, not needed without twofactors
|
// Remove the recovery code, not needed without twofactors
|
||||||
|
@ -123,7 +123,7 @@ fn disable_twofactor(data: JsonUpcase<DisableTwoFactorData>, headers: Headers, c
|
||||||
let type_ = data.Type.into_i32().expect("Invalid type");
|
let type_ = data.Type.into_i32().expect("Invalid type");
|
||||||
|
|
||||||
if let Some(twofactor) = TwoFactor::find_by_user_and_type(&user.uuid, type_, &conn) {
|
if let Some(twofactor) = TwoFactor::find_by_user_and_type(&user.uuid, type_, &conn) {
|
||||||
twofactor.delete(&conn).expect("Error deleting twofactor");
|
twofactor.delete(&conn)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
|
@ -205,7 +205,7 @@ fn activate_authenticator(data: JsonUpcase<EnableAuthenticatorData>, headers: He
|
||||||
}
|
}
|
||||||
|
|
||||||
_generate_recover_code(&mut user, &conn);
|
_generate_recover_code(&mut user, &conn);
|
||||||
twofactor.save(&conn).expect("Error saving twofactor");
|
twofactor.save(&conn)?;
|
||||||
|
|
||||||
Ok(Json(json!({
|
Ok(Json(json!({
|
||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
|
|
Loading…
Reference in a new issue