protected_actions.rs (728B)
1 use crate::{auth::Headers, error::Error}; 2 use rocket::{Route, serde::json::Json}; 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 #[post("/accounts/request-otp")] 9 fn request_otp(_headers: Headers) -> Error { 10 Error::new(DEVICE_LOG_IN_MSG, DEVICE_LOG_IN_MSG) 11 } 12 13 #[derive(Deserialize, Serialize)] 14 #[serde(rename_all = "camelCase")] 15 struct ProtectedActionVerify { 16 otp: String, 17 } 18 19 #[expect(unused, clippy::needless_pass_by_value, reason = "upstream")] 20 #[post("/accounts/verify-otp", data = "<data>")] 21 fn verify_otp(data: Json<ProtectedActionVerify>, _headers: Headers) -> Error { 22 Error::new(DEVICE_LOG_IN_MSG, DEVICE_LOG_IN_MSG) 23 }