synapse_admin_api/users/reset_password/
v1.rs

1//! [POST /_synapse/admin/v1/reset_password/:user_id](https://github.com/element-hq/synapse/blob/master/docs/admin_api/user_admin_api.md#reset-password)
2
3use ruma::{
4    OwnedUserId,
5    api::{auth_scheme::AccessToken, metadata, request, response},
6};
7
8metadata! {
9    method: POST,
10    rate_limited: false,
11    authentication: AccessToken,
12    path: "/_synapse/admin/v1/reset_password/{user_id}",
13}
14
15#[request]
16pub struct Request {
17    /// user ID of the account to reset the password
18    #[ruma_api(path)]
19    pub user_id: OwnedUserId,
20
21    /// new password
22    pub new_password: String,
23
24    /// Logout all devices of the user, so it necessary to login with the new password again.
25    /// Defaults to true.
26    #[serde(default = "ruma::serde::default_true")]
27    pub logout_devices: bool,
28}
29
30#[derive(Default)]
31#[response]
32pub struct Response {}
33
34impl Request {
35    /// Creates an `Request` with the given user ID and the new password.
36    pub fn new(user_id: OwnedUserId, new_password: String) -> Self {
37        Self { user_id, new_password, logout_devices: true }
38    }
39}
40
41impl Response {
42    /// Creates an empty `Response`.
43    pub fn new() -> Self {
44        Self {}
45    }
46}