vw_small

Hardened fork of Vaultwarden (https://github.com/dani-garcia/vaultwarden) with fewer features.
git clone https://git.philomathiclife.com/repos/vw_small
Log | Files | Refs | README

duo.rs (1282B)


      1 use crate::{api::PasswordOrOtpData, auth::Headers, error::Error};
      2 use rocket::{serde::json::Json, Route};
      3 
      4 pub fn routes() -> Vec<Route> {
      5     routes![activate_duo, activate_duo_put, get_duo]
      6 }
      7 const DUO_DISABLED_MSG: &str = "Duo is disabled.";
      8 #[allow(unused_variables, clippy::needless_pass_by_value)]
      9 #[post("/two-factor/get-duo", data = "<data>")]
     10 fn get_duo(data: Json<PasswordOrOtpData>, _headers: Headers) -> Error {
     11     Error::new(DUO_DISABLED_MSG, DUO_DISABLED_MSG)
     12 }
     13 
     14 #[derive(Deserialize)]
     15 #[serde(rename_all = "camelCase")]
     16 struct EnableDuoData {
     17     #[allow(dead_code)]
     18     host: String,
     19     #[allow(dead_code)]
     20     secret_key: String,
     21     #[allow(dead_code)]
     22     integration_key: String,
     23     #[allow(dead_code)]
     24     master_password_hash: Option<String>,
     25     #[allow(dead_code)]
     26     otp: Option<String>,
     27 }
     28 
     29 #[allow(unused_variables, clippy::needless_pass_by_value)]
     30 #[post("/two-factor/duo", data = "<data>")]
     31 fn activate_duo(data: Json<EnableDuoData>, _headers: Headers) -> Error {
     32     Error::new(DUO_DISABLED_MSG, DUO_DISABLED_MSG)
     33 }
     34 
     35 #[allow(unused_variables, clippy::needless_pass_by_value)]
     36 #[put("/two-factor/duo", data = "<data>")]
     37 fn activate_duo_put(data: Json<EnableDuoData>, _headers: Headers) -> Error {
     38     Error::new(DUO_DISABLED_MSG, DUO_DISABLED_MSG)
     39 }