setpassword endpoint, misc

This commit is contained in:
2026-03-01 00:31:15 +01:00
parent c8d15f8c6b
commit b2a80ffa58
4 changed files with 34 additions and 6 deletions

View File

@@ -16,6 +16,8 @@ use crate::{
},
};
const CANT_REVOKE: &str = "You don't have permission to change this user's password.";
pub async fn get_by_id(
Path(id): Path<Uuid>,
headers: HeaderMap,
@@ -48,11 +50,7 @@ pub async fn revoke_by_id(
Ok(Json(s).into_response())
}
false => match u.has_permission(Permission::ListOthersSessions)? {
true => Ok((
StatusCode::FORBIDDEN,
"You don't have permission to revoke this session.",
)
.into_response()),
true => Ok((StatusCode::FORBIDDEN, CANT_REVOKE).into_response()),
false => Err(SessionError::NoSessionWithId(id))?,
},
}