summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Valois <[email protected]>2023-10-02 17:33:52 +0200
committerMathieu Valois <[email protected]>2023-10-03 16:41:06 +0200
commitbf41d74501907bd545b471752eb2b51f000a9500 (patch)
tree4b8459d4fea26357ec03bbd2f4d5620d1f994fbe /src
parentbc26bfa589c007da9b9be37e1172060f38a948b9 (diff)
downloadvaultwarden-bf41d74501907bd545b471752eb2b51f000a9500.tar.gz
vaultwarden-bf41d74501907bd545b471752eb2b51f000a9500.zip
Adds LastActive on /admin/users API route
Diffstat (limited to 'src')
-rw-r--r--src/api/admin.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/admin.rs b/src/api/admin.rs
index 9eb965cc..59beab1e 100644
--- a/src/api/admin.rs
+++ b/src/api/admin.rs
@@ -326,6 +326,10 @@ async fn get_users_json(_token: AdminToken, mut conn: DbConn) -> Json<Value> {
let mut usr = u.to_json(&mut conn).await;
usr["UserEnabled"] = json!(u.enabled);
usr["CreatedAt"] = json!(format_naive_datetime_local(&u.created_at, DT_FMT));
+ usr["LastActive"] = match u.last_active(&mut conn).await {
+ Some(dt) => json!(format_naive_datetime_local(&dt, DT_FMT)),
+ None => json!("Never"),
+ };
users_json.push(usr);
}