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

protected_actions.rs (757B)


      1 use crate::{auth::Headers, error::Error};
      2 use rocket::{serde::json::Json, Route};
      3 
      4 pub fn routes() -> Vec<Route> {
      5     routes![request_otp, verify_otp]
      6 }
      7 const DEVICE_LOG_IN_MSG: &str = "Log in via device is disabled.";
      8 #[allow(clippy::needless_pass_by_value)]
      9 #[post("/accounts/request-otp")]
     10 fn request_otp(_headers: Headers) -> Error {
     11     Error::new(DEVICE_LOG_IN_MSG, DEVICE_LOG_IN_MSG)
     12 }
     13 
     14 #[derive(Deserialize, Serialize)]
     15 #[serde(rename_all = "camelCase")]
     16 struct ProtectedActionVerify {
     17     otp: String,
     18 }
     19 
     20 #[allow(unused_variables, clippy::needless_pass_by_value)]
     21 #[post("/accounts/verify-otp", data = "<data>")]
     22 fn verify_otp(data: Json<ProtectedActionVerify>, _headers: Headers) -> Error {
     23     Error::new(DEVICE_LOG_IN_MSG, DEVICE_LOG_IN_MSG)
     24 }