1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-11-26 05:50:29 +01:00

Merge branch 'master' into admin-disable-user

Dieser Commit ist enthalten in:
Daniel García 2020-12-08 15:42:37 +01:00 committet von GitHub
Commit b32f4451ee
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
14 geänderte Dateien mit 263 neuen und 261 gelöschten Zeilen

448
Cargo.lock generiert

Datei-Diff unterdrückt, da er zu groß ist Diff laden

Datei anzeigen

@ -32,7 +32,7 @@ rocket = { version = "0.5.0-dev", features = ["tls"], default-features = false }
rocket_contrib = "0.5.0-dev" rocket_contrib = "0.5.0-dev"
# HTTP client # HTTP client
reqwest = { version = "0.10.8", features = ["blocking", "json"] } reqwest = { version = "0.10.9", features = ["blocking", "json"] }
# multipart/form-data support # multipart/form-data support
multipart = { version = "0.17.0", features = ["server"], default-features = false } multipart = { version = "0.17.0", features = ["server"], default-features = false }
@ -49,7 +49,7 @@ chashmap = "2.2.2"
# A generic serialization/deserialization framework # A generic serialization/deserialization framework
serde = "1.0.117" serde = "1.0.117"
serde_derive = "1.0.117" serde_derive = "1.0.117"
serde_json = "1.0.59" serde_json = "1.0.60"
# Logging # Logging
log = "0.4.11" log = "0.4.11"
@ -64,7 +64,7 @@ libsqlite3-sys = { version = "0.18.0", features = ["bundled"], optional = true }
# Crypto-related libraries # Crypto-related libraries
rand = "0.7.3" rand = "0.7.3"
ring = "0.16.15" ring = "0.16.19"
# UUID generation # UUID generation
uuid = { version = "0.8.1", features = ["v4"] } uuid = { version = "0.8.1", features = ["v4"] }
@ -72,7 +72,7 @@ uuid = { version = "0.8.1", features = ["v4"] }
# Date and time libraries # Date and time libraries
chrono = "0.4.19" chrono = "0.4.19"
chrono-tz = "0.5.3" chrono-tz = "0.5.3"
time = "0.2.22" time = "0.2.23"
# TOTP library # TOTP library
oath = "0.10.2" oath = "0.10.2"
@ -93,7 +93,7 @@ yubico = { version = "0.9.1", features = ["online-tokio"], default-features = fa
dotenv = { version = "0.15.0", default-features = false } dotenv = { version = "0.15.0", default-features = false }
# Lazy initialization # Lazy initialization
once_cell = "1.4.1" once_cell = "1.5.2"
# Numerical libraries # Numerical libraries
num-traits = "0.2.14" num-traits = "0.2.14"
@ -120,18 +120,18 @@ percent-encoding = "2.1.0"
idna = "0.2.0" idna = "0.2.0"
# CLI argument parsing # CLI argument parsing
structopt = "0.3.20" structopt = "0.3.21"
# Logging panics to logfile instead stderr only # Logging panics to logfile instead stderr only
backtrace = "0.3.54" backtrace = "0.3.55"
# Macro ident concatenation # Macro ident concatenation
paste = "1.0.2" paste = "1.0.3"
[patch.crates-io] [patch.crates-io]
# Use newest ring # Use newest ring
rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = '1010f6a2a88fac899dec0cd2f642156908038a53' } rocket = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' }
rocket_contrib = { git = 'https://github.com/SergioBenitez/Rocket', rev = '1010f6a2a88fac899dec0cd2f642156908038a53' } rocket_contrib = { git = 'https://github.com/SergioBenitez/Rocket', rev = '263e39b5b429de1913ce7e3036575a7b4d88b6d7' }
# For favicon extraction from main website # For favicon extraction from main website
data-url = { git = 'https://github.com/servo/rust-url', package="data-url", rev = '7f1bd6ce1c2fde599a757302a843a60e714c5f72' } data-url = { git = 'https://github.com/servo/rust-url', package="data-url", rev = '540ede02d0771824c0c80ff9f57fe8eff38b1291' }

Datei anzeigen

@ -1,10 +1,10 @@
# This file was generated using a Jinja2 template. # This file was generated using a Jinja2 template.
# Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfile's. # Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfile's.
{% set build_stage_base_image = "rust:1.46" %} {% set build_stage_base_image = "rust:1.48" %}
{% if "alpine" in target_file %} {% if "alpine" in target_file %}
{% if "amd64" in target_file %} {% if "amd64" in target_file %}
{% set build_stage_base_image = "clux/muslrust:nightly-2020-10-02" %} {% set build_stage_base_image = "clux/muslrust:nightly-2020-11-22" %}
{% set runtime_stage_base_image = "alpine:3.12" %} {% set runtime_stage_base_image = "alpine:3.12" %}
{% set package_arch_target = "x86_64-unknown-linux-musl" %} {% set package_arch_target = "x86_64-unknown-linux-musl" %}
{% elif "arm32v7" in target_file %} {% elif "arm32v7" in target_file %}
@ -62,8 +62,13 @@ FROM bitwardenrs/web-vault@{{ vault_image_hash }} as vault
FROM {{ build_stage_base_image }} as build FROM {{ build_stage_base_image }} as build
{% if "alpine" in target_file %} {% if "alpine" in target_file %}
# Alpine only works on SQlite {% if "amd64" in target_file -%}
# Alpine-based AMD64 (musl) does not support mysql/mariadb during compile time.
ARG DB=sqlite,postgresql
{% else -%}
# Alpine-based ARM (musl) only supports sqlite during compile time.
ARG DB=sqlite ARG DB=sqlite
{% endif %}
{% else %} {% else %}
# Debian-based builds support multidb # Debian-based builds support multidb
ARG DB=sqlite,mysql,postgresql ARG DB=sqlite,mysql,postgresql

Datei anzeigen

@ -18,7 +18,7 @@
FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM rust:1.46 as build FROM rust:1.48 as build
# Debian-based builds support multidb # Debian-based builds support multidb
ARG DB=sqlite,mysql,postgresql ARG DB=sqlite,mysql,postgresql

Datei anzeigen

@ -18,10 +18,10 @@
FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM clux/muslrust:nightly-2020-10-02 as build FROM clux/muslrust:nightly-2020-11-22 as build
# Alpine only works on SQlite # Alpine-based AMD64 (musl) does not support mysql/mariadb during compile time.
ARG DB=sqlite ARG DB=sqlite,postgresql
# Build time options to avoid dpkg warnings and help with reproducible builds. # Build time options to avoid dpkg warnings and help with reproducible builds.
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 TZ=UTC TERM=xterm-256color ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 TZ=UTC TERM=xterm-256color

Datei anzeigen

@ -18,7 +18,7 @@
FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM rust:1.46 as build FROM rust:1.48 as build
# Debian-based builds support multidb # Debian-based builds support multidb
ARG DB=sqlite,mysql,postgresql ARG DB=sqlite,mysql,postgresql

Datei anzeigen

@ -18,7 +18,7 @@
FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM rust:1.46 as build FROM rust:1.48 as build
# Debian-based builds support multidb # Debian-based builds support multidb
ARG DB=sqlite,mysql,postgresql ARG DB=sqlite,mysql,postgresql

Datei anzeigen

@ -20,7 +20,7 @@ FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab683
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM messense/rust-musl-cross:armv7-musleabihf as build FROM messense/rust-musl-cross:armv7-musleabihf as build
# Alpine only works on SQlite # Alpine-based ARM (musl) only supports sqlite during compile time.
ARG DB=sqlite ARG DB=sqlite
# Build time options to avoid dpkg warnings and help with reproducible builds. # Build time options to avoid dpkg warnings and help with reproducible builds.

Datei anzeigen

@ -18,7 +18,7 @@
FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault FROM bitwardenrs/web-vault@sha256:e40228f94cead5e50af6575fb39850a002dad146dab6836e5da5663e6d214303 as vault
########################## BUILD IMAGE ########################## ########################## BUILD IMAGE ##########################
FROM rust:1.46 as build FROM rust:1.48 as build
# Debian-based builds support multidb # Debian-based builds support multidb
ARG DB=sqlite,mysql,postgresql ARG DB=sqlite,mysql,postgresql

Datei anzeigen

@ -1 +1 @@
nightly-2020-10-14 nightly-2020-11-22

Datei anzeigen

@ -300,6 +300,11 @@ fn users_overview(_token: AdminToken, conn: DbConn) -> ApiResult<Html<String>> {
usr["attachment_count"] = json!(Attachment::count_by_user(&u.uuid, &conn)); usr["attachment_count"] = json!(Attachment::count_by_user(&u.uuid, &conn));
usr["attachment_size"] = json!(get_display_size(Attachment::size_by_user(&u.uuid, &conn) as i32)); usr["attachment_size"] = json!(get_display_size(Attachment::size_by_user(&u.uuid, &conn) as i32));
usr["user_enabled"] = json!(u.enabled); usr["user_enabled"] = json!(u.enabled);
usr["created_at"] = json!(&u.created_at.format("%Y-%m-%d %H:%M:%S").to_string());
usr["last_active"] = match u.last_active(&conn) {
Some(timestamp) => json!(timestamp.format("%Y-%m-%d %H:%M:%S").to_string()),
None => json!("Never")
};
usr usr
}).collect(); }).collect();

Datei anzeigen

@ -178,4 +178,15 @@ impl Device {
.from_db() .from_db()
}} }}
} }
pub fn find_latest_active_by_user(user_uuid: &str, conn: &DbConn) -> Option<Self> {
db_run! { conn: {
devices::table
.filter(devices::user_uuid.eq(user_uuid))
.order(devices::updated_at.desc())
.first::<DeviceDb>(conn)
.ok()
.from_db()
}}
}
} }

Datei anzeigen

@ -290,6 +290,13 @@ impl User {
users::table.load::<UserDb>(conn).expect("Error loading users").from_db() users::table.load::<UserDb>(conn).expect("Error loading users").from_db()
}} }}
} }
pub fn last_active(&self, conn: &DbConn) -> Option<NaiveDateTime> {
match Device::find_latest_active_by_user(&self.uuid, conn) {
Some(device) => Some(device.updated_at),
None => None
}
}
} }
impl Invitation { impl Invitation {

Datei anzeigen

@ -21,6 +21,8 @@
<div class="float-left"> <div class="float-left">
<strong>{{Name}}</strong> <strong>{{Name}}</strong>
<span class="d-block">{{Email}}</span> <span class="d-block">{{Email}}</span>
<span class="d-block">Created at: {{created_at}}</span>
<span class="d-block">Last active: {{last_active}}</span>
<span class="d-block"> <span class="d-block">
{{#unless user_enabled}} {{#unless user_enabled}}
<span class="badge badge-danger mr-2" title="User is disabled">Disabled</span> <span class="badge badge-danger mr-2" title="User is disabled">Disabled</span>