From 89b5f7c98d0e655f712e8adc732b2cf32adc771d Mon Sep 17 00:00:00 2001 From: BlackDex Date: Sun, 22 Aug 2021 13:46:48 +0200 Subject: [PATCH 1/9] Dependency updates Updated several dependencies and switch to different totp library. - Switch oath with totp-lite oauth hasn't been updated in a long while and some dependencies could not be updated any more It now also validates a preseeding 0, as the previous library returned an int instead of a str which stripped a leading 0 - Updated rust to the current latest nightly (including build image) - Updated bootstrap css and js - Updated hadolint to latest version - Updated default rust image from v1.53 to v1.54 - Updated new nightly build/clippy messages --- .github/workflows/hadolint.yml | 2 +- Cargo.lock | 335 ++++------- Cargo.toml | 16 +- docker/Dockerfile.j2 | 4 +- docker/amd64/Dockerfile | 2 +- docker/amd64/Dockerfile.alpine | 2 +- docker/arm64/Dockerfile | 2 +- docker/armv6/Dockerfile | 2 +- docker/armv7/Dockerfile | 2 +- rust-toolchain | 2 +- src/api/core/two_factor/authenticator.rs | 34 +- src/db/mod.rs | 3 - src/static/scripts/bootstrap-native.js | 37 +- src/static/scripts/bootstrap.css | 731 ++++++++++++++++++----- 14 files changed, 750 insertions(+), 424 deletions(-) diff --git a/.github/workflows/hadolint.yml b/.github/workflows/hadolint.yml index e52e5c07..36406cb8 100644 --- a/.github/workflows/hadolint.yml +++ b/.github/workflows/hadolint.yml @@ -28,7 +28,7 @@ jobs: sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${HADOLINT_VERSION}/hadolint-$(uname -s)-$(uname -m) -o /usr/local/bin/hadolint && \ sudo chmod +x /usr/local/bin/hadolint env: - HADOLINT_VERSION: 2.5.0 + HADOLINT_VERSION: 2.6.1 # End Download hadolint # Test Dockerfiles diff --git a/Cargo.lock b/Cargo.lock index db93ff8b..5072c529 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.15.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a2e47a1fbe209ee101dd6d61285226744c6c8d3c21c8dc878ba6cb9f467f3a" +checksum = "3e61f2b7f93d2c7d2b08263acaa4a363b3e276806c68af6134c44f523bf1aacd" dependencies = [ "gimli", ] @@ -28,9 +28,9 @@ dependencies = [ [[package]] name = "alloc-no-stdlib" -version = "2.0.1" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5192ec435945d87bc2f70992b4d818154b5feede43c09fb7592146374eac90a6" +checksum = "35ef4730490ad1c4eae5c4325b2a95f521d023e5c885853ff7aca0a6a1631db3" [[package]] name = "alloc-stdlib" @@ -74,9 +74,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7815ea54e4d821e791162e078acbebfd6d8c8939cd559c9335dceb1c8ca7282" +checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" dependencies = [ "addr2line", "cc", @@ -129,9 +129,9 @@ checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" [[package]] name = "bitflags" -version = "1.2.1" +version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitvec" @@ -152,7 +152,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ "block-padding", - "byte-tools 0.3.1", + "byte-tools", "byteorder", "generic-array 0.12.4", ] @@ -172,14 +172,14 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" dependencies = [ - "byte-tools 0.3.1", + "byte-tools", ] [[package]] name = "brotli" -version = "3.3.0" +version = "3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f29919120f08613aadcd4383764e00526fc9f18b6c0895814faeed0dd78613e" +checksum = "71cb90ade945043d3d53597b2fc359bb063db8ade2bcffe7997351d0756e9d50" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -188,9 +188,9 @@ dependencies = [ [[package]] name = "brotli-decompressor" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1052e1c3b8d4d80eb84a8b94f0a1498797b5fb96314c001156a1c761940ef4ec" +checksum = "59ad2d4653bf5ca36ae797b1f4bb4dbddb60ce49ca4aed8a2ce4829f60425b80" dependencies = [ "alloc-no-stdlib", "alloc-stdlib", @@ -212,12 +212,6 @@ version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c59e7af012c713f529e7a3ee57ce9b31ddd858d4b512923602f74608b009631" -[[package]] -name = "byte-tools" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0919189ba800c7ffe8778278116b7e0de3905ab81c72abb69c85cbfef7991279" - [[package]] name = "byte-tools" version = "0.3.1" @@ -304,12 +298,6 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f92cfa0fd5690b3cf8c1ef2cabbd9b7ef22fa53cf5e1f92b05103f6d5d1cf6e7" -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - [[package]] name = "cookie" version = "0.14.4" @@ -411,19 +399,19 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.3.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba62c86c26dcba13c278afcaac0c7452486fe604a2668a0dfa4e0edc98d8a9e" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" dependencies = [ - "constant_time_eq", - "generic-array 0.7.3", + "generic-array 0.14.4", + "subtle", ] [[package]] name = "crypto-mac" -version = "0.10.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" dependencies = [ "generic-array 0.14.4", "subtle", @@ -469,7 +457,7 @@ dependencies = [ "bitflags", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -497,7 +485,7 @@ checksum = "45f5098f628d02a7a0f68ddba586fb61e80edec3bdc1be3b921f4ceec60858d3" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -510,15 +498,6 @@ dependencies = [ "migrations_macros", ] -[[package]] -name = "digest" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a68d759d7a66a4f63d5bd2a2b14ad7e8cf93fe8c9be227031cd4e72ab0e9ee8" -dependencies = [ - "generic-array 0.7.3", -] - [[package]] name = "digest" version = "0.8.1" @@ -537,16 +516,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "digest-buffer" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb92364e9f6d3da159257250532d448b218406d2acb149f724e8f48e9f5cb9a" -dependencies = [ - "byte-tools 0.1.3", - "generic-array 0.7.3", -] - [[package]] name = "discard" version = "1.0.4" @@ -747,7 +716,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -783,16 +752,6 @@ dependencies = [ "slab", ] -[[package]] -name = "generic-array" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbe043cf9b85297937897087de81f590361686e1ac2d4d471b45435de5dfb6a6" -dependencies = [ - "nodrop", - "typenum", -] - [[package]] name = "generic-array" version = "0.12.4" @@ -836,9 +795,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.24.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4075386626662786ddb0ec9081e7c7eeb1ba31951f447ca780ef9f5d568189" +checksum = "f0a01e0497841a3b2db4f8afa483cce65f7e96a3498bd6c541734792aeac8fe7" [[package]] name = "glob" @@ -848,9 +807,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "h2" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "825343c4eef0b63f541f8903f395dc5beb362a979b5799a84062527ef1e37726" +checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" dependencies = [ "bytes 1.0.1", "fnv", @@ -873,9 +832,9 @@ checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3" [[package]] name = "handlebars" -version = "4.1.0" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a0ffab8c36d0436114310c7e10b59b3307e650ddfabf6d006028e29a70c6e6" +checksum = "fd85ecabdb47308d28d3a4113224fefcab2510ccb4e463aee0a1362eb84c756a" dependencies = [ "log 0.4.14", "pest", @@ -903,22 +862,21 @@ dependencies = [ [[package]] name = "hmac" -version = "0.1.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb5aa9647ba4711e9d6968dc1c810cd23989ed435443ca962e1bf6d8b8b83ff" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ - "crypto-mac 0.3.0", - "digest 0.5.2", - "generic-array 0.7.3", + "crypto-mac 0.10.1", + "digest 0.9.0", ] [[package]] name = "hmac" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac 0.10.1", + "crypto-mac 0.11.1", "digest 0.9.0", ] @@ -944,7 +902,7 @@ dependencies = [ "markup5ever", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -960,9 +918,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60daa14be0e0786db0f03a9e57cb404c9d756eed2b6c62b9ea98ec5743ec75a9" +checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" dependencies = [ "bytes 1.0.1", "http", @@ -971,9 +929,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.4.1" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a87b616e37e93c22fb19bcd386f02f3af5ea98a25670ad0fce773de23c5e68" +checksum = "acd94fdbe1d4ff688b67b04eee2e17bd50995534a61539e45adfefb45e5e5503" [[package]] name = "httpdate" @@ -1107,9 +1065,9 @@ checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] name = "job_scheduler" @@ -1123,9 +1081,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.51" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83bdfbace3a0e81a4253f73b49e960b053e396a11012cbd49b9b74d6a2b67062" +checksum = "e4bf49d50e2961077d9c99f4b7997d770a1114f087c3c2e0069b36c13fc2979d" dependencies = [ "wasm-bindgen", ] @@ -1195,9 +1153,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.98" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "a1fa8cddc8fbbee11227ef194b5317ed014b8acbf15139bd716a18ad3fe99ec5" [[package]] name = "libsqlite3-sys" @@ -1283,9 +1241,9 @@ checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" [[package]] name = "matches" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" [[package]] name = "maybe-uninit" @@ -1295,9 +1253,9 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "migrations_internals" @@ -1317,7 +1275,7 @@ dependencies = [ "migrations_internals", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -1450,9 +1408,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8d96b2e1c8da3957d58100b09f102c6d9cfdfced01b7ec5a8974044bb09dbd4" +checksum = "48ba9f7719b5a0f42f338907614285fb5fd70e53858141f69898a1fb7203b24d" dependencies = [ "lazy_static", "libc", @@ -1483,12 +1441,6 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "nom" version = "4.1.1" @@ -1538,7 +1490,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -1570,24 +1522,11 @@ dependencies = [ "libc", ] -[[package]] -name = "oath" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec6405dc6afe8219020d535f9ad888a12b191bbc8ce1c55f7ee663bde5be80ca" -dependencies = [ - "digest 0.5.2", - "hmac 0.1.1", - "rustc-hex", - "sha-1 0.3.4", - "sha2", -] - [[package]] name = "object" -version = "0.25.3" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7" +checksum = "ee2766204889d09937d00bfbb7fec56bb2a199e2ade963cab19185d8a6104c7c" dependencies = [ "memchr", ] @@ -1612,9 +1551,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.35" +version = "0.10.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885" +checksum = "8d9facdb76fec0b73c406f125d44d86fdad818d66fef0531eec9233ca425ff4a" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1641,9 +1580,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.65" +version = "0.9.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d" +checksum = "1996d2d305e561b70d1ee0c53f1542833f4e1ac6ce9a6708b6ff2738ca67dc82" dependencies = [ "autocfg", "cc", @@ -1816,7 +1755,7 @@ dependencies = [ "pest_meta", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2154,9 +2093,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" dependencies = [ "bitflags", ] @@ -2255,9 +2194,9 @@ dependencies = [ [[package]] name = "rmpv" -version = "0.4.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c760afe11955e16121e36485b6b828326c3f0eaff1c31758d96dbeb5cf09fd5" +checksum = "de8813b3a2f95c5138fe5925bfb8784175d88d6bff059ba8ce090aa891319754" dependencies = [ "num-traits", "rmp", @@ -2332,12 +2271,6 @@ version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49" -[[package]] -name = "rustc-hex" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceb8ce7a5e520de349e1fa172baeba4a9e8d5ef06c47471863530bc4972ee1e" - [[package]] name = "rustc_version" version = "0.2.3" @@ -2456,9 +2389,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7505abeacaec74ae4778d9d9328fe5a5d04253220a85c4ee022239fc996d03" +checksum = "1056a0db1978e9dbf0f6e4fca677f6f9143dc1c19de346f22cac23e422196834" dependencies = [ "serde_derive", ] @@ -2474,9 +2407,9 @@ dependencies = [ [[package]] name = "serde_cbor" -version = "0.11.1" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622" +checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" dependencies = [ "half", "serde", @@ -2484,20 +2417,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.126" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "963a7dbc9895aeac7ac90e74f34a5d5261828f79df35cbed41e10189d3804d43" +checksum = "13af2fbb8b60a8950d6c72a56d2095c28870367cc8e10c55e9745bac4995a2c4" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] name = "serde_json" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" +checksum = "336b10da19a12ad094b59d870ebde26a45402e5b470add4b5fd03c5048a32127" dependencies = [ "itoa", "ryu", @@ -2516,19 +2449,6 @@ dependencies = [ "serde", ] -[[package]] -name = "sha-1" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8347606816471548cd60f0abd5ef0d513a81f5202dbdab9c09f17a15b5248484" -dependencies = [ - "byte-tools 0.1.3", - "digest 0.5.2", - "digest-buffer", - "fake-simd", - "generic-array 0.7.3", -] - [[package]] name = "sha-1" version = "0.8.2" @@ -2562,15 +2482,15 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" -version = "0.5.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84920f9ac881e94e33ec89e1b3dcd36040523a308a92548e01217ce35d8cf6a8" +checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" dependencies = [ - "byte-tools 0.1.3", - "digest 0.5.2", - "digest-buffer", - "fake-simd", - "generic-array 0.7.3", + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", ] [[package]] @@ -2586,15 +2506,15 @@ dependencies = [ [[package]] name = "siphasher" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbce6d4507c7e4a3962091436e56e95290cb71fa302d0d270e32130b75fbff27" +checksum = "729a25c17d72b06c68cb47955d44fda88ad2d3e7d77e025663fdd69b93dd71a1" [[package]] name = "slab" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f173ac3d1a7e3b28003f40de0b5ce7fe2710f9b9dc3fc38664cebee46b3b6527" +checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590" [[package]] name = "smallvec" @@ -2613,9 +2533,9 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "socket2" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dfc207c526015c632472a77be09cf1b6e46866581aecae5cc38fb4235dea2" +checksum = "765f090f0e423d2b55843402a07915add955e7d60657db13707a159727326cad" dependencies = [ "libc", "winapi 0.3.9", @@ -2672,7 +2592,7 @@ dependencies = [ "quote 1.0.9", "serde", "serde_derive", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2688,7 +2608,7 @@ dependencies = [ "serde_derive", "serde_json", "sha1", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2741,9 +2661,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.74" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1873d832550d4588c3dbc20f01361ab00bfe741048f71e3fecf145a7cc18b29c" +checksum = "b7f58f7e8eaa0009c5fec437aabf511bd9933e4b2d7407bd05273c01a8906ea7" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", @@ -2810,7 +2730,7 @@ checksum = "060d69a0afe7796bf42e9e2ff91f5ee691fb15c53d38b4b62a9a53eb23164745" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2868,7 +2788,7 @@ dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", "standback", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] @@ -2888,9 +2808,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7b349f11a7047e6d1276853e612d152f5e8a352c61917887cc2169e2366b4c" +checksum = "01cf844b23c6131f624accf65ce0e4e9956a8bb329400ea5bcc26ae3a5c20b0b" dependencies = [ "autocfg", "bytes 1.0.1", @@ -2947,6 +2867,18 @@ dependencies = [ "serde", ] +[[package]] +name = "totp-lite" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b18009e8be74bfb2e2cc59a63d078d95c042858a1ca1128a294e1f9ce225148b" +dependencies = [ + "digest 0.9.0", + "hmac 0.11.0", + "sha-1 0.9.7", + "sha2", +] + [[package]] name = "tower-service" version = "0.3.1" @@ -2974,14 +2906,14 @@ checksum = "c42e6fa53307c8a17e4ccd4dc81cf5ec38db9209f59b222210375b54ee40d1e2" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", ] [[package]] name = "tracing-core" -version = "0.1.18" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9ff14f98b1a4b289c6248a023c1c2fa1491062964e9fed67ab29c4e4da4a052" +checksum = "2ca517f43f0fb96e0c3072ed5c275fe5eece87e8cb52f4a77b69226d3b1c9df8" dependencies = [ "lazy_static", ] @@ -3062,12 +2994,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb8be209bb1c96b7c177c7420d26e04eccacb0eeae6b980e35fcb74678107e0" -dependencies = [ - "matches", -] +checksum = "246f4c42e67e7a4e3c6106ff716a5d067d4132a642840b242e357e468a2a0085" [[package]] name = "unicode-normalization" @@ -3163,7 +3092,6 @@ dependencies = [ "multipart", "num-derive", "num-traits", - "oath", "once_cell", "openssl", "parity-ws", @@ -3181,6 +3109,7 @@ dependencies = [ "serde_json", "syslog", "time 0.2.27", + "totp-lite", "tracing", "u2f", "url 2.2.2", @@ -3242,9 +3171,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" +checksum = "8ce9b1b516211d33767048e5d47fa2a381ed8b76fc48d2ce4aa39877f9f183e0" dependencies = [ "cfg-if 1.0.0", "serde", @@ -3254,24 +3183,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b33f6a0694ccfea53d94db8b2ed1c3a8a4c86dd936b13b9f0a15ec4a451b900" +checksum = "cfe8dc78e2326ba5f845f4b5bf548401604fa20b1dd1d365fb73b6c1d6364041" dependencies = [ "bumpalo", "lazy_static", "log 0.4.14", "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fba7978c679d53ce2d0ac80c8c175840feb849a161664365d1287b41f2e67f1" +checksum = "95fded345a6559c2cfee778d562300c581f7d4ff3edb9b0d230d69800d213972" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3281,9 +3210,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "088169ca61430fe1e58b8096c24975251700e7b1f6fd91cc9d59b04fb9b18bd4" +checksum = "44468aa53335841d9d6b6c023eaab07c0cd4bddbcfdee3e2bb1e8d2cb8069fef" dependencies = [ "quote 1.0.9", "wasm-bindgen-macro-support", @@ -3291,28 +3220,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be2241542ff3d9f241f5e2cb6dd09b37efe786df8851c54957683a49f0987a97" +checksum = "0195807922713af1e67dc66132c7328206ed9766af3858164fb583eedc25fbad" dependencies = [ "proc-macro2 1.0.28", "quote 1.0.9", - "syn 1.0.74", + "syn 1.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.74" +version = "0.2.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7cff876b8f18eed75a66cf49b65e7f967cb354a7aa16003fb55dbfd25b44b4f" +checksum = "acdb075a845574a1fa5f09fd77e43f7747599301ea3417a9fbffdeedfc1f4a29" [[package]] name = "web-sys" -version = "0.3.51" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e828417b379f3df7111d3a2a9e5753706cae29c41f7c4029ee9fd77f3e09e582" +checksum = "224b2f6b67919060055ef1a67807367c2066ed520c3862cc013d26cf893a783c" dependencies = [ "js-sys", "wasm-bindgen", @@ -3320,9 +3249,9 @@ dependencies = [ [[package]] name = "webauthn-rs" -version = "0.3.0-alpha.9" +version = "0.3.0-alpha.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bbb2b77105c3b25ef0187146d80824648da0645f650c4d2080e3815d6cbbb87" +checksum = "18010e64d5f6286eab221881ed6237a3a1f0aa420e78fb6faa48843c7dd93da1" dependencies = [ "base64 0.13.0", "log 0.4.14", diff --git a/Cargo.toml b/Cargo.toml index cf9e3fac..2f9dc2e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,14 +47,14 @@ multipart = { version = "0.18.0", features = ["server"], default-features = fals ws = { version = "0.11.0", package = "parity-ws" } # MessagePack library -rmpv = "0.4.7" +rmpv = "1.0.0" # Concurrent hashmap implementation chashmap = "2.2.2" # A generic serialization/deserialization framework -serde = { version = "1.0.126", features = ["derive"] } -serde_json = "1.0.64" +serde = { version = "1.0.128", features = ["derive"] } +serde_json = "1.0.66" # Logging log = "0.4.14" @@ -83,7 +83,7 @@ time = "0.2.27" job_scheduler = "1.2.1" # TOTP library -oath = "0.10.2" +totp-lite = "1.0.3" # Data encoding library data-encoding = "2.3.2" @@ -93,7 +93,7 @@ jsonwebtoken = "7.2.0" # U2F library u2f = "0.2.0" -webauthn-rs = "=0.3.0-alpha.9" +webauthn-rs = "=0.3.0-alpha.10" # Yubico Library yubico = { version = "0.10.0", features = ["online-tokio"], default-features = false } @@ -113,7 +113,7 @@ tracing = { version = "0.1.26", features = ["log"] } # Needed to have lettre tra lettre = { version = "0.10.0-rc.3", features = ["smtp-transport", "builder", "serde", "native-tls", "hostname", "tracing"], default-features = false } # Template library -handlebars = { version = "4.1.0", features = ["dir_source"] } +handlebars = { version = "4.1.2", features = ["dir_source"] } # For favicon extraction from main website html5ever = "0.25.1" @@ -122,7 +122,7 @@ regex = { version = "1.5.4", features = ["std", "perf"], default-features = fals data-url = "0.1.0" # Used by U2F, JWT and Postgres -openssl = "0.10.35" +openssl = "0.10.36" # URL encoding library percent-encoding = "2.1.0" @@ -133,7 +133,7 @@ idna = "0.2.3" pico-args = "0.4.2" # Logging panics to logfile instead stderr only -backtrace = "0.3.60" +backtrace = "0.3.61" # Macro ident concatenation paste = "1.0.5" diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index 1787c932..f3031cd9 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -1,10 +1,10 @@ # This file was generated using a Jinja2 template. # Please make your changes in `Dockerfile.j2` and then `make` the individual Dockerfiles. -{% set build_stage_base_image = "rust:1.53" %} +{% set build_stage_base_image = "rust:1.54" %} {% if "alpine" in target_file %} {% if "amd64" in target_file %} -{% set build_stage_base_image = "clux/muslrust:nightly-2021-06-24" %} +{% set build_stage_base_image = "clux/muslrust:nightly-2021-08-22" %} {% set runtime_stage_base_image = "alpine:3.14" %} {% set package_arch_target = "x86_64-unknown-linux-musl" %} {% elif "armv7" in target_file %} diff --git a/docker/amd64/Dockerfile b/docker/amd64/Dockerfile index 70d9c8f7..1c067c11 100644 --- a/docker/amd64/Dockerfile +++ b/docker/amd64/Dockerfile @@ -25,7 +25,7 @@ FROM vaultwarden/web-vault@sha256:29a4fa7bf3790fff9d908b02ac5a154913491f4bf30c95b87b06d8cf1c5516b5 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.53 as build +FROM rust:1.54 as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql diff --git a/docker/amd64/Dockerfile.alpine b/docker/amd64/Dockerfile.alpine index a056b960..22b159d1 100644 --- a/docker/amd64/Dockerfile.alpine +++ b/docker/amd64/Dockerfile.alpine @@ -25,7 +25,7 @@ FROM vaultwarden/web-vault@sha256:29a4fa7bf3790fff9d908b02ac5a154913491f4bf30c95b87b06d8cf1c5516b5 as vault ########################## BUILD IMAGE ########################## -FROM clux/muslrust:nightly-2021-06-24 as build +FROM clux/muslrust:nightly-2021-08-22 as build # Alpine-based AMD64 (musl) does not support mysql/mariadb during compile time. ARG DB=sqlite,postgresql diff --git a/docker/arm64/Dockerfile b/docker/arm64/Dockerfile index 64ab1352..2358568d 100644 --- a/docker/arm64/Dockerfile +++ b/docker/arm64/Dockerfile @@ -25,7 +25,7 @@ FROM vaultwarden/web-vault@sha256:29a4fa7bf3790fff9d908b02ac5a154913491f4bf30c95b87b06d8cf1c5516b5 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.53 as build +FROM rust:1.54 as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql diff --git a/docker/armv6/Dockerfile b/docker/armv6/Dockerfile index 305aef4b..4511c69e 100644 --- a/docker/armv6/Dockerfile +++ b/docker/armv6/Dockerfile @@ -25,7 +25,7 @@ FROM vaultwarden/web-vault@sha256:29a4fa7bf3790fff9d908b02ac5a154913491f4bf30c95b87b06d8cf1c5516b5 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.53 as build +FROM rust:1.54 as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql diff --git a/docker/armv7/Dockerfile b/docker/armv7/Dockerfile index a0e1a0e8..04cd92f1 100644 --- a/docker/armv7/Dockerfile +++ b/docker/armv7/Dockerfile @@ -25,7 +25,7 @@ FROM vaultwarden/web-vault@sha256:29a4fa7bf3790fff9d908b02ac5a154913491f4bf30c95b87b06d8cf1c5516b5 as vault ########################## BUILD IMAGE ########################## -FROM rust:1.53 as build +FROM rust:1.54 as build # Debian-based builds support multidb ARG DB=sqlite,mysql,postgresql diff --git a/rust-toolchain b/rust-toolchain index 050a5f2e..635f06df 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2021-06-24 \ No newline at end of file +nightly-2021-08-22 diff --git a/src/api/core/two_factor/authenticator.rs b/src/api/core/two_factor/authenticator.rs index 36ce137a..e72d7b29 100644 --- a/src/api/core/two_factor/authenticator.rs +++ b/src/api/core/two_factor/authenticator.rs @@ -62,7 +62,7 @@ fn activate_authenticator( let data: EnableAuthenticatorData = data.into_inner().data; let password_hash = data.MasterPasswordHash; let key = data.Key; - let token = data.Token.into_i32()? as u64; + let token = data.Token.into_string(); let mut user = headers.user; @@ -81,7 +81,7 @@ fn activate_authenticator( } // Validate the token provided with the key, and save new twofactor - validate_totp_code(&user.uuid, token, &key.to_uppercase(), &ip, &conn)?; + validate_totp_code(&user.uuid, &token, &key.to_uppercase(), &ip, &conn)?; _generate_recover_code(&mut user, &conn); @@ -109,16 +109,15 @@ pub fn validate_totp_code_str( ip: &ClientIp, conn: &DbConn, ) -> EmptyResult { - let totp_code: u64 = match totp_code.parse() { - Ok(code) => code, - _ => err!("TOTP code is not a number"), - }; + if !totp_code.chars().all(char::is_numeric) { + err!("TOTP code is not a number"); + } validate_totp_code(user_uuid, totp_code, secret, ip, conn) } -pub fn validate_totp_code(user_uuid: &str, totp_code: u64, secret: &str, ip: &ClientIp, conn: &DbConn) -> EmptyResult { - use oath::{totp_raw_custom_time, HashType}; +pub fn validate_totp_code(user_uuid: &str, totp_code: &str, secret: &str, ip: &ClientIp, conn: &DbConn) -> EmptyResult { + use totp_lite::{totp_custom, Sha1}; let decoded_secret = match BASE32.decode(secret.as_bytes()) { Ok(s) => s, @@ -130,27 +129,28 @@ pub fn validate_totp_code(user_uuid: &str, totp_code: u64, secret: &str, ip: &Cl _ => TwoFactor::new(user_uuid.to_string(), TwoFactorType::Authenticator, secret.to_string()), }; - // Get the current system time in UNIX Epoch (UTC) - let current_time = chrono::Utc::now(); - let current_timestamp = current_time.timestamp(); - // The amount of steps back and forward in time // Also check if we need to disable time drifted TOTP codes. // If that is the case, we set the steps to 0 so only the current TOTP is valid. let steps = !CONFIG.authenticator_disable_time_drift() as i64; + // Get the current system time in UNIX Epoch (UTC) + let current_time = chrono::Utc::now(); + let current_timestamp = current_time.timestamp(); + for step in -steps..=steps { let time_step = current_timestamp / 30i64 + step; - // We need to calculate the time offsite and cast it as an i128. - // Else we can't do math with it on a default u64 variable. + + // We need to calculate the time offsite and cast it as an u64. + // Since we only have times into the future and the totp generator needs an u64 instead of the default i64. let time = (current_timestamp + step * 30i64) as u64; - let generated = totp_raw_custom_time(&decoded_secret, 6, 0, 30, time, &HashType::SHA1); + let generated = totp_custom::(30, 6, &decoded_secret, time); // Check the the given code equals the generated and if the time_step is larger then the one last used. if generated == totp_code && time_step > twofactor.last_used as i64 { // If the step does not equals 0 the time is drifted either server or client side. if step != 0 { - info!("TOTP Time drift detected. The step offset is {}", step); + warn!("TOTP Time drift detected. The step offset is {}", step); } // Save the last used time step so only totp time steps higher then this one are allowed. @@ -159,7 +159,7 @@ pub fn validate_totp_code(user_uuid: &str, totp_code: u64, secret: &str, ip: &Cl twofactor.save(conn)?; return Ok(()); } else if generated == totp_code && time_step <= twofactor.last_used as i64 { - warn!("This or a TOTP code within {} steps back and forward has already been used!", steps); + warn!("This TOTP or a TOTP code within {} steps back or forward has already been used!", steps); err!(format!("Invalid TOTP code! Server time: {} IP: {}", current_time.format("%F %T UTC"), ip.ip)); } } diff --git a/src/db/mod.rs b/src/db/mod.rs index b52f4661..bcbb7ce4 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -278,7 +278,6 @@ impl<'a, 'r> FromRequest<'a, 'r> for DbConn { // https://docs.rs/diesel_migrations/*/diesel_migrations/macro.embed_migrations.html #[cfg(sqlite)] mod sqlite_migrations { - #[allow(unused_imports)] embed_migrations!("migrations/sqlite"); pub fn run_migrations() -> Result<(), super::Error> { @@ -315,7 +314,6 @@ mod sqlite_migrations { #[cfg(mysql)] mod mysql_migrations { - #[allow(unused_imports)] embed_migrations!("migrations/mysql"); pub fn run_migrations() -> Result<(), super::Error> { @@ -336,7 +334,6 @@ mod mysql_migrations { #[cfg(postgresql)] mod postgresql_migrations { - #[allow(unused_imports)] embed_migrations!("migrations/postgresql"); pub fn run_migrations() -> Result<(), super::Error> { diff --git a/src/static/scripts/bootstrap-native.js b/src/static/scripts/bootstrap-native.js index e5aa0830..82e63f27 100644 --- a/src/static/scripts/bootstrap-native.js +++ b/src/static/scripts/bootstrap-native.js @@ -1,5 +1,5 @@ /*! - * Native JavaScript for Bootstrap v4.0.2 (https://thednp.github.io/bootstrap.native/) + * Native JavaScript for Bootstrap v4.0.4 (https://thednp.github.io/bootstrap.native/) * Copyright 2015-2021 © dnp_theme * Licensed under MIT (https://github.com/thednp/bootstrap.native/blob/master/LICENSE) */ @@ -933,14 +933,14 @@ const self = this; // initialization element - const { element } = self; + const { element, options } = self; // set triggering elements self.triggers = Array.from(document.querySelectorAll(collapseToggleSelector)) .filter((btn) => getTargetElement(btn) === element); // set parent accordion - self.parent = queryElement(self.options.parent); + self.parent = queryElement(options.parent); const { parent } = self; // set initial state @@ -1067,6 +1067,7 @@ const { element, menu, originalClass, menuEnd, options, } = self; + const { offset } = options; const parent = element.parentElement; // reset menu offset and position @@ -1075,14 +1076,16 @@ removeClass(parent, 'position-static'); if (!show) { + const menuEndNow = hasClass(menu, dropdownMenuEndClass); parent.className = originalClass.join(' '); - const menuAction = menuEnd && !hasClass(menu, dropdownMenuEndClass) ? addClass : removeClass; - menuAction(menu, dropdownMenuEndClass); + if (menuEndNow && !menuEnd) removeClass(menu, dropdownMenuEndClass); + else if (!menuEndNow && menuEnd) addClass(menu, dropdownMenuEndClass); return; } - const { offset } = options; - let positionClass = dropdownMenuClasses.find((c) => originalClass.includes(c)); + // set initial position class + // take into account .btn-group parent as .dropdown + let positionClass = dropdownMenuClasses.find((c) => originalClass.includes(c)) || dropdownString; let dropdownMargin = { dropdown: [offset, 0, 0], @@ -1125,8 +1128,6 @@ // dropup const topExceed = targetBCR.top - menuDimensions.h < 0; - const btnGroup = parent.parentNode.closest('.btn-group,.btn-group-vertical'); - // recompute position if (horizontalClass.includes(positionClass) && leftFullExceed && rightFullExceed) { positionClass = dropdownString; @@ -1162,10 +1163,8 @@ // update dropdown / dropup to handle parent btn-group element // as well as the dropdown-menu-end utility class if (verticalClass.includes(positionClass)) { - const menuEndAction = rightExceed ? addClass : removeClass; - - if (!btnGroup) menuEndAction(menu, dropdownMenuEndClass); - else if (leftExceed) addClass(parent, 'position-static'); + if (!menuEnd && rightExceed) addClass(menu, dropdownMenuEndClass); + else if (menuEnd && leftExceed) removeClass(menu, dropdownMenuEndClass); if (hasClass(menu, dropdownMenuEndClass)) { Object.keys(dropdownPosition.menuEnd).forEach((p) => { @@ -1185,6 +1184,7 @@ document[action]('focus', dropdownDismissHandler); document[action]('keydown', dropdownPreventScroll); document[action]('keyup', dropdownKeyHandler); + if (self.options.display === 'dynamic') { window[action]('scroll', dropdownLayoutHandler, passiveHandler); window[action]('resize', dropdownLayoutHandler, passiveHandler); @@ -1197,7 +1197,7 @@ } function getCurrentOpenDropdown() { - const currentParent = dropdownMenuClasses + const currentParent = dropdownMenuClasses.concat('btn-group') .map((c) => document.getElementsByClassName(`${c} ${showClass}`)) .find((x) => x.length); @@ -1333,7 +1333,7 @@ show(related) { const self = this; - const currentParent = queryElement(dropdownMenuClasses.map((c) => `.${c}.${showClass}`).join(',')); + const currentParent = queryElement(dropdownMenuClasses.concat('btn-group').map((c) => `.${c}.${showClass}`).join(',')); const currentElement = currentParent && queryElement(dropdownSelector, currentParent); if (currentElement) currentElement[dropdownComponent].hide(); @@ -3169,9 +3169,8 @@ if (hideToastEvent.defaultPrevented) return; clearTimeout(self.timer); - self.timer = setTimeout(() => closeToast(self), // Bugfix by BlackDex to get autohide with a delay working. - noTimer ? 10 : options.delay, - ); + self.timer = setTimeout(() => closeToast(self), + noTimer ? 10 : options.delay); } } @@ -3484,7 +3483,7 @@ constructor: Tooltip, }; - var version = "4.0.2"; + var version = "4.0.4"; // import { alertInit } from '../components/alert-native.js'; // import { buttonInit } from '../components/button-native.js'; diff --git a/src/static/scripts/bootstrap.css b/src/static/scripts/bootstrap.css index 386e8b06..da83b00f 100644 --- a/src/static/scripts/bootstrap.css +++ b/src/static/scripts/bootstrap.css @@ -1,6 +1,6 @@ @charset "UTF-8"; /*! - * Bootstrap v5.0.1 (https://getbootstrap.com/) + * Bootstrap v5.1.0 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors * Copyright 2011-2021 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) @@ -19,6 +19,15 @@ --bs-white: #fff; --bs-gray: #6c757d; --bs-gray-dark: #343a40; + --bs-gray-100: #f8f9fa; + --bs-gray-200: #e9ecef; + --bs-gray-300: #dee2e6; + --bs-gray-400: #ced4da; + --bs-gray-500: #adb5bd; + --bs-gray-600: #6c757d; + --bs-gray-700: #495057; + --bs-gray-800: #343a40; + --bs-gray-900: #212529; --bs-primary: #0d6efd; --bs-secondary: #6c757d; --bs-success: #198754; @@ -27,9 +36,26 @@ --bs-danger: #dc3545; --bs-light: #f8f9fa; --bs-dark: #212529; + --bs-primary-rgb: 13, 110, 253; + --bs-secondary-rgb: 108, 117, 125; + --bs-success-rgb: 25, 135, 84; + --bs-info-rgb: 13, 202, 240; + --bs-warning-rgb: 255, 193, 7; + --bs-danger-rgb: 220, 53, 69; + --bs-light-rgb: 248, 249, 250; + --bs-dark-rgb: 33, 37, 41; + --bs-white-rgb: 255, 255, 255; + --bs-black-rgb: 0, 0, 0; + --bs-body-rgb: 33, 37, 41; --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)); + --bs-body-font-family: var(--bs-font-sans-serif); + --bs-body-font-size: 1rem; + --bs-body-font-weight: 400; + --bs-body-line-height: 1.5; + --bs-body-color: #212529; + --bs-body-bg: #fff; } *, @@ -46,12 +72,13 @@ body { margin: 0; - font-family: var(--bs-font-sans-serif); - font-size: 1rem; - font-weight: 400; - line-height: 1.5; - color: #212529; - background-color: #fff; + font-family: var(--bs-body-font-family); + font-size: var(--bs-body-font-size); + font-weight: var(--bs-body-font-weight); + line-height: var(--bs-body-line-height); + color: var(--bs-body-color); + text-align: var(--bs-body-text-align); + background-color: var(--bs-body-bg); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } @@ -634,15 +661,15 @@ progress { display: flex; flex-wrap: wrap; margin-top: calc(var(--bs-gutter-y) * -1); - margin-right: calc(var(--bs-gutter-x) / -2); - margin-left: calc(var(--bs-gutter-x) / -2); + margin-right: calc(var(--bs-gutter-x) * -.5); + margin-left: calc(var(--bs-gutter-x) * -.5); } .row > * { flex-shrink: 0; width: 100%; max-width: 100%; - padding-right: calc(var(--bs-gutter-x) / 2); - padding-left: calc(var(--bs-gutter-x) / 2); + padding-right: calc(var(--bs-gutter-x) * .5); + padding-left: calc(var(--bs-gutter-x) * .5); margin-top: var(--bs-gutter-y); } @@ -692,12 +719,12 @@ progress { .col-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-3 { @@ -707,12 +734,12 @@ progress { .col-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-6 { @@ -722,12 +749,12 @@ progress { .col-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-9 { @@ -737,12 +764,12 @@ progress { .col-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-12 { @@ -751,11 +778,11 @@ progress { } .offset-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-3 { @@ -763,11 +790,11 @@ progress { } .offset-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-6 { @@ -775,11 +802,11 @@ progress { } .offset-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-9 { @@ -787,11 +814,11 @@ progress { } .offset-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-0, @@ -901,12 +928,12 @@ progress { .col-sm-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-sm-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-sm-3 { @@ -916,12 +943,12 @@ progress { .col-sm-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-sm-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-sm-6 { @@ -931,12 +958,12 @@ progress { .col-sm-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-sm-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-sm-9 { @@ -946,12 +973,12 @@ progress { .col-sm-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-sm-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-sm-12 { @@ -964,11 +991,11 @@ progress { } .offset-sm-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-sm-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-sm-3 { @@ -976,11 +1003,11 @@ progress { } .offset-sm-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-sm-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-sm-6 { @@ -988,11 +1015,11 @@ progress { } .offset-sm-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-sm-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-sm-9 { @@ -1000,11 +1027,11 @@ progress { } .offset-sm-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-sm-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-sm-0, @@ -1114,12 +1141,12 @@ progress { .col-md-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-md-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-md-3 { @@ -1129,12 +1156,12 @@ progress { .col-md-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-md-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-md-6 { @@ -1144,12 +1171,12 @@ progress { .col-md-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-md-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-md-9 { @@ -1159,12 +1186,12 @@ progress { .col-md-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-md-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-md-12 { @@ -1177,11 +1204,11 @@ progress { } .offset-md-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-md-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-md-3 { @@ -1189,11 +1216,11 @@ progress { } .offset-md-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-md-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-md-6 { @@ -1201,11 +1228,11 @@ progress { } .offset-md-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-md-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-md-9 { @@ -1213,11 +1240,11 @@ progress { } .offset-md-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-md-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-md-0, @@ -1327,12 +1354,12 @@ progress { .col-lg-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-lg-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-lg-3 { @@ -1342,12 +1369,12 @@ progress { .col-lg-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-lg-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-lg-6 { @@ -1357,12 +1384,12 @@ progress { .col-lg-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-lg-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-lg-9 { @@ -1372,12 +1399,12 @@ progress { .col-lg-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-lg-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-lg-12 { @@ -1390,11 +1417,11 @@ progress { } .offset-lg-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-lg-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-lg-3 { @@ -1402,11 +1429,11 @@ progress { } .offset-lg-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-lg-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-lg-6 { @@ -1414,11 +1441,11 @@ progress { } .offset-lg-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-lg-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-lg-9 { @@ -1426,11 +1453,11 @@ progress { } .offset-lg-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-lg-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-lg-0, @@ -1540,12 +1567,12 @@ progress { .col-xl-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-xl-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-xl-3 { @@ -1555,12 +1582,12 @@ progress { .col-xl-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-xl-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-xl-6 { @@ -1570,12 +1597,12 @@ progress { .col-xl-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-xl-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-xl-9 { @@ -1585,12 +1612,12 @@ progress { .col-xl-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-xl-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-xl-12 { @@ -1603,11 +1630,11 @@ progress { } .offset-xl-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-xl-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-xl-3 { @@ -1615,11 +1642,11 @@ progress { } .offset-xl-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-xl-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-xl-6 { @@ -1627,11 +1654,11 @@ progress { } .offset-xl-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-xl-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-xl-9 { @@ -1639,11 +1666,11 @@ progress { } .offset-xl-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-xl-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-xl-0, @@ -1753,12 +1780,12 @@ progress { .col-xxl-1 { flex: 0 0 auto; - width: 8.3333333333%; + width: 8.33333333%; } .col-xxl-2 { flex: 0 0 auto; - width: 16.6666666667%; + width: 16.66666667%; } .col-xxl-3 { @@ -1768,12 +1795,12 @@ progress { .col-xxl-4 { flex: 0 0 auto; - width: 33.3333333333%; + width: 33.33333333%; } .col-xxl-5 { flex: 0 0 auto; - width: 41.6666666667%; + width: 41.66666667%; } .col-xxl-6 { @@ -1783,12 +1810,12 @@ progress { .col-xxl-7 { flex: 0 0 auto; - width: 58.3333333333%; + width: 58.33333333%; } .col-xxl-8 { flex: 0 0 auto; - width: 66.6666666667%; + width: 66.66666667%; } .col-xxl-9 { @@ -1798,12 +1825,12 @@ progress { .col-xxl-10 { flex: 0 0 auto; - width: 83.3333333333%; + width: 83.33333333%; } .col-xxl-11 { flex: 0 0 auto; - width: 91.6666666667%; + width: 91.66666667%; } .col-xxl-12 { @@ -1816,11 +1843,11 @@ progress { } .offset-xxl-1 { - margin-left: 8.3333333333%; + margin-left: 8.33333333%; } .offset-xxl-2 { - margin-left: 16.6666666667%; + margin-left: 16.66666667%; } .offset-xxl-3 { @@ -1828,11 +1855,11 @@ progress { } .offset-xxl-4 { - margin-left: 33.3333333333%; + margin-left: 33.33333333%; } .offset-xxl-5 { - margin-left: 41.6666666667%; + margin-left: 41.66666667%; } .offset-xxl-6 { @@ -1840,11 +1867,11 @@ progress { } .offset-xxl-7 { - margin-left: 58.3333333333%; + margin-left: 58.33333333%; } .offset-xxl-8 { - margin-left: 66.6666666667%; + margin-left: 66.66666667%; } .offset-xxl-9 { @@ -1852,11 +1879,11 @@ progress { } .offset-xxl-10 { - margin-left: 83.3333333333%; + margin-left: 83.33333333%; } .offset-xxl-11 { - margin-left: 91.6666666667%; + margin-left: 91.66666667%; } .g-xxl-0, @@ -2309,7 +2336,7 @@ textarea.form-control-lg { } .form-control-color { - max-width: 3rem; + width: 3rem; height: auto; padding: 0.375rem; } @@ -2329,6 +2356,7 @@ textarea.form-control-lg { display: block; width: 100%; padding: 0.375rem 2.25rem 0.375rem 0.75rem; + -moz-padding-start: calc(0.75rem - 3px); font-size: 1rem; font-weight: 400; line-height: 1.5; @@ -2340,10 +2368,16 @@ textarea.form-control-lg { background-size: 16px 12px; border: 1px solid #ced4da; border-radius: 0.25rem; + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; -webkit-appearance: none; -moz-appearance: none; appearance: none; } +@media (prefers-reduced-motion: reduce) { + .form-select { + transition: none; + } +} .form-select:focus { border-color: #86b7fe; outline: 0; @@ -2576,7 +2610,7 @@ textarea.form-control-lg { .form-floating > .form-control, .form-floating > .form-select { height: calc(3.5rem + 2px); - padding: 1rem 0.75rem; + line-height: 1.25; } .form-floating > label { position: absolute; @@ -2594,6 +2628,9 @@ textarea.form-control-lg { transition: none; } } +.form-floating > .form-control { + padding: 1rem 0.75rem; +} .form-floating > .form-control::-moz-placeholder { color: transparent; } @@ -3415,6 +3452,16 @@ textarea.form-control-lg { transition: none; } } +.collapsing.collapse-horizontal { + width: 0; + height: auto; + transition: width 0.35s ease; +} +@media (prefers-reduced-motion: reduce) { + .collapsing.collapse-horizontal { + transition: none; + } +} .dropup, .dropend, @@ -3466,16 +3513,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-end { --bs-position: end; } .dropdown-menu-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } @media (min-width: 576px) { @@ -3483,16 +3530,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-sm-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-sm-end { --bs-position: end; } .dropdown-menu-sm-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } } @media (min-width: 768px) { @@ -3500,16 +3547,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-md-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-md-end { --bs-position: end; } .dropdown-menu-md-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } } @media (min-width: 992px) { @@ -3517,16 +3564,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-lg-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-lg-end { --bs-position: end; } .dropdown-menu-lg-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } } @media (min-width: 1200px) { @@ -3534,16 +3581,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-xl-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-xl-end { --bs-position: end; } .dropdown-menu-xl-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } } @media (min-width: 1400px) { @@ -3551,16 +3598,16 @@ textarea.form-control-lg { --bs-position: start; } .dropdown-menu-xxl-start[data-bs-popper] { - right: auto /* rtl:ignore */; - left: 0 /* rtl:ignore */; + right: auto; + left: 0; } .dropdown-menu-xxl-end { --bs-position: end; } .dropdown-menu-xxl-end[data-bs-popper] { - right: 0 /* rtl:ignore */; - left: auto /* rtl:ignore */; + right: 0; + left: auto; } } .dropup .dropdown-menu[data-bs-popper] { @@ -4032,6 +4079,33 @@ textarea.form-control-lg { .navbar-expand-sm .navbar-toggler { display: none; } + .navbar-expand-sm .offcanvas-header { + display: none; + } + .navbar-expand-sm .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; + } + .navbar-expand-sm .offcanvas-top, +.navbar-expand-sm .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; + } + .navbar-expand-sm .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } } @media (min-width: 768px) { .navbar-expand-md { @@ -4058,6 +4132,33 @@ textarea.form-control-lg { .navbar-expand-md .navbar-toggler { display: none; } + .navbar-expand-md .offcanvas-header { + display: none; + } + .navbar-expand-md .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; + } + .navbar-expand-md .offcanvas-top, +.navbar-expand-md .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; + } + .navbar-expand-md .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } } @media (min-width: 992px) { .navbar-expand-lg { @@ -4084,6 +4185,33 @@ textarea.form-control-lg { .navbar-expand-lg .navbar-toggler { display: none; } + .navbar-expand-lg .offcanvas-header { + display: none; + } + .navbar-expand-lg .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; + } + .navbar-expand-lg .offcanvas-top, +.navbar-expand-lg .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; + } + .navbar-expand-lg .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } } @media (min-width: 1200px) { .navbar-expand-xl { @@ -4110,6 +4238,33 @@ textarea.form-control-lg { .navbar-expand-xl .navbar-toggler { display: none; } + .navbar-expand-xl .offcanvas-header { + display: none; + } + .navbar-expand-xl .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; + } + .navbar-expand-xl .offcanvas-top, +.navbar-expand-xl .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; + } + .navbar-expand-xl .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } } @media (min-width: 1400px) { .navbar-expand-xxl { @@ -4136,6 +4291,33 @@ textarea.form-control-lg { .navbar-expand-xxl .navbar-toggler { display: none; } + .navbar-expand-xxl .offcanvas-header { + display: none; + } + .navbar-expand-xxl .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; + } + .navbar-expand-xxl .offcanvas-top, +.navbar-expand-xxl .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; + } + .navbar-expand-xxl .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } } .navbar-expand { flex-wrap: nowrap; @@ -4161,6 +4343,33 @@ textarea.form-control-lg { .navbar-expand .navbar-toggler { display: none; } +.navbar-expand .offcanvas-header { + display: none; +} +.navbar-expand .offcanvas { + position: inherit; + bottom: 0; + z-index: 1000; + flex-grow: 1; + visibility: visible !important; + background-color: transparent; + border-right: 0; + border-left: 0; + transition: none; + transform: none; +} +.navbar-expand .offcanvas-top, +.navbar-expand .offcanvas-bottom { + height: auto; + border-top: 0; + border-bottom: 0; +} +.navbar-expand .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; +} .navbar-light .navbar-brand { color: rgba(0, 0, 0, 0.9); @@ -4284,9 +4493,6 @@ textarea.form-control-lg { margin-bottom: 0; } -.card-link:hover { - text-decoration: none; -} .card-link + .card-link { margin-left: 1rem; } @@ -5162,10 +5368,10 @@ textarea.form-control-lg { box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); border-radius: 0.25rem; } -.toast:not(.showing):not(.show) { +.toast.showing { opacity: 0; } -.toast.hide { +.toast:not(.show) { display: none; } @@ -5205,7 +5411,7 @@ textarea.form-control-lg { position: fixed; top: 0; left: 0; - z-index: 1060; + z-index: 1055; display: none; width: 100%; height: 100%; @@ -5270,7 +5476,7 @@ textarea.form-control-lg { position: fixed; top: 0; left: 0; - z-index: 1040; + z-index: 1050; width: 100vw; height: 100vh; background-color: #000; @@ -5700,7 +5906,7 @@ textarea.form-control-lg { margin-bottom: 0; font-size: 1rem; background-color: #f0f0f0; - border-bottom: 1px solid #d8d8d8; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); border-top-left-radius: calc(0.3rem - 1px); border-top-right-radius: calc(0.3rem - 1px); } @@ -5995,7 +6201,7 @@ textarea.form-control-lg { .offcanvas { position: fixed; bottom: 0; - z-index: 1050; + z-index: 1045; display: flex; flex-direction: column; max-width: 100%; @@ -6011,6 +6217,22 @@ textarea.form-control-lg { } } +.offcanvas-backdrop { + position: fixed; + top: 0; + left: 0; + z-index: 1040; + width: 100vw; + height: 100vh; + background-color: #000; +} +.offcanvas-backdrop.fade { + opacity: 0; +} +.offcanvas-backdrop.show { + opacity: 0.5; +} + .offcanvas-header { display: flex; align-items: center; @@ -6019,7 +6241,9 @@ textarea.form-control-lg { } .offcanvas-header .btn-close { padding: 0.5rem 0.5rem; - margin: -0.5rem -0.5rem -0.5rem auto; + margin-top: -0.5rem; + margin-right: -0.5rem; + margin-bottom: -0.5rem; } .offcanvas-title { @@ -6072,6 +6296,69 @@ textarea.form-control-lg { transform: none; } +.placeholder { + display: inline-block; + min-height: 1em; + vertical-align: middle; + cursor: wait; + background-color: currentColor; + opacity: 0.5; +} +.placeholder.btn::before { + display: inline-block; + content: ""; +} + +.placeholder-xs { + min-height: 0.6em; +} + +.placeholder-sm { + min-height: 0.8em; +} + +.placeholder-lg { + min-height: 1.2em; +} + +.placeholder-glow .placeholder { + -webkit-animation: placeholder-glow 2s ease-in-out infinite; + animation: placeholder-glow 2s ease-in-out infinite; +} + +@-webkit-keyframes placeholder-glow { + 50% { + opacity: 0.2; + } +} + +@keyframes placeholder-glow { + 50% { + opacity: 0.2; + } +} +.placeholder-wave { + -webkit-mask-image: linear-gradient(130deg, #000 55%, rgba(0, 0, 0, 0.8) 75%, #000 95%); + mask-image: linear-gradient(130deg, #000 55%, rgba(0, 0, 0, 0.8) 75%, #000 95%); + -webkit-mask-size: 200% 100%; + mask-size: 200% 100%; + -webkit-animation: placeholder-wave 2s linear infinite; + animation: placeholder-wave 2s linear infinite; +} + +@-webkit-keyframes placeholder-wave { + 100% { + -webkit-mask-position: -200% 0%; + mask-position: -200% 0%; + } +} + +@keyframes placeholder-wave { + 100% { + -webkit-mask-position: -200% 0%; + mask-position: -200% 0%; + } +} .clearfix::after { display: block; clear: both; @@ -6230,6 +6517,20 @@ textarea.form-control-lg { z-index: 1020; } } +.hstack { + display: flex; + flex-direction: row; + align-items: center; + align-self: stretch; +} + +.vstack { + display: flex; + flex: 1 1 auto; + flex-direction: column; + align-self: stretch; +} + .visually-hidden, .visually-hidden-focusable:not(:focus):not(:focus-within) { position: absolute !important; @@ -6259,6 +6560,15 @@ textarea.form-control-lg { white-space: nowrap; } +.vr { + display: inline-block; + align-self: stretch; + width: 1px; + min-height: 1em; + background-color: currentColor; + opacity: 0.25; +} + .align-baseline { vertical-align: baseline !important; } @@ -6295,6 +6605,26 @@ textarea.form-control-lg { float: none !important; } +.opacity-0 { + opacity: 0 !important; +} + +.opacity-25 { + opacity: 0.25 !important; +} + +.opacity-50 { + opacity: 0.5 !important; +} + +.opacity-75 { + opacity: 0.75 !important; +} + +.opacity-100 { + opacity: 1 !important; +} + .overflow-auto { overflow: auto !important; } @@ -7318,105 +7648,176 @@ textarea.form-control-lg { /* rtl:end:remove */ .text-primary { - color: #0d6efd !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important; } .text-secondary { - color: #6c757d !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-secondary-rgb), var(--bs-text-opacity)) !important; } .text-success { - color: #198754 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-success-rgb), var(--bs-text-opacity)) !important; } .text-info { - color: #0dcaf0 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-info-rgb), var(--bs-text-opacity)) !important; } .text-warning { - color: #ffc107 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-warning-rgb), var(--bs-text-opacity)) !important; } .text-danger { - color: #dc3545 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-danger-rgb), var(--bs-text-opacity)) !important; } .text-light { - color: #f8f9fa !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-light-rgb), var(--bs-text-opacity)) !important; } .text-dark { - color: #212529 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-dark-rgb), var(--bs-text-opacity)) !important; +} + +.text-black { + --bs-text-opacity: 1; + color: rgba(var(--bs-black-rgb), var(--bs-text-opacity)) !important; } .text-white { - color: #fff !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-white-rgb), var(--bs-text-opacity)) !important; } .text-body { - color: #212529 !important; + --bs-text-opacity: 1; + color: rgba(var(--bs-body-rgb), var(--bs-text-opacity)) !important; } .text-muted { + --bs-text-opacity: 1; color: #6c757d !important; } .text-black-50 { + --bs-text-opacity: 1; color: rgba(0, 0, 0, 0.5) !important; } .text-white-50 { + --bs-text-opacity: 1; color: rgba(255, 255, 255, 0.5) !important; } .text-reset { + --bs-text-opacity: 1; color: inherit !important; } +.text-opacity-25 { + --bs-text-opacity: 0.25; +} + +.text-opacity-50 { + --bs-text-opacity: 0.5; +} + +.text-opacity-75 { + --bs-text-opacity: 0.75; +} + +.text-opacity-100 { + --bs-text-opacity: 1; +} + .bg-primary { - background-color: #0d6efd !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important; } .bg-secondary { - background-color: #6c757d !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-secondary-rgb), var(--bs-bg-opacity)) !important; } .bg-success { - background-color: #198754 !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-success-rgb), var(--bs-bg-opacity)) !important; } .bg-info { - background-color: #0dcaf0 !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-info-rgb), var(--bs-bg-opacity)) !important; } .bg-warning { - background-color: #ffc107 !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-warning-rgb), var(--bs-bg-opacity)) !important; } .bg-danger { - background-color: #dc3545 !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-danger-rgb), var(--bs-bg-opacity)) !important; } .bg-light { - background-color: #f8f9fa !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-light-rgb), var(--bs-bg-opacity)) !important; } .bg-dark { - background-color: #212529 !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-dark-rgb), var(--bs-bg-opacity)) !important; } -.bg-body { - background-color: #fff !important; +.bg-black { + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-black-rgb), var(--bs-bg-opacity)) !important; } .bg-white { - background-color: #fff !important; + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-white-rgb), var(--bs-bg-opacity)) !important; +} + +.bg-body { + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-body-rgb), var(--bs-bg-opacity)) !important; } .bg-transparent { + --bs-bg-opacity: 1; background-color: transparent !important; } +.bg-opacity-10 { + --bs-bg-opacity: 0.1; +} + +.bg-opacity-25 { + --bs-bg-opacity: 0.25; +} + +.bg-opacity-50 { + --bs-bg-opacity: 0.5; +} + +.bg-opacity-75 { + --bs-bg-opacity: 0.75; +} + +.bg-opacity-100 { + --bs-bg-opacity: 1; +} + .bg-gradient { background-image: var(--bs-gradient) !important; } @@ -10817,4 +11218,4 @@ textarea.form-control-lg { } } -/*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file +/*# sourceMappingURL=bootstrap.css.map */ From 58b046fd10f4cd953ba5a0e5a816df480f98061f Mon Sep 17 00:00:00 2001 From: BlackDex Date: Sat, 21 Aug 2021 10:36:08 +0200 Subject: [PATCH 2/9] Fix syncing with Bitwarden Desktop v1.28.0 Syncing with the latest desktop client (v1.28.0) fails because it expects some json key/values to be there. This PR adds those key/value pairs. Resolves #1924 --- src/db/models/organization.rs | 2 ++ src/db/models/user.rs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index e5141bb8..000b63e9 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -290,6 +290,8 @@ impl UserOrganization { // For now they still have that code also in the web-vault, but they will remove it at some point. // https://github.com/bitwarden/server/tree/master/bitwarden_license/src/ "UseBusinessPortal": false, // Disable BusinessPortal Button + "ProviderId": null, + "ProviderName": null, // TODO: Add support for Custom User Roles // See: https://bitwarden.com/help/article/user-types-access-control/#custom-role diff --git a/src/db/models/user.rs b/src/db/models/user.rs index b370d356..fb7d5fcd 100644 --- a/src/db/models/user.rs +++ b/src/db/models/user.rs @@ -210,7 +210,10 @@ impl User { "PrivateKey": self.private_key, "SecurityStamp": self.security_stamp, "Organizations": orgs_json, - "Object": "profile" + "Providers": [], + "ProviderOrganizations": [], + "ForcePasswordReset": false, + "Object": "profile", }) } From 91e80657e4c09cf3b9c254de81724b664a7ba2e3 Mon Sep 17 00:00:00 2001 From: Jeremy Lin Date: Wed, 18 Aug 2021 20:30:18 -0700 Subject: [PATCH 3/9] Fix error with adding file attachment from org vault view --- src/api/core/ciphers.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index f9133bec..bd87d3c5 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -783,10 +783,7 @@ struct AttachmentRequestData { Key: String, FileName: String, FileSize: i32, - // We check org owner/admin status via is_write_accessible_to_user(), - // so we can just ignore this field. - // - // AdminRequest: bool, + AdminRequest: Option, // true when attaching from an org vault view } enum FileUploadType { @@ -821,14 +818,17 @@ fn post_attachment_v2( attachment.save(&conn).expect("Error saving attachment"); let url = format!("/ciphers/{}/attachment/{}", cipher.uuid, attachment_id); + let response_key = match data.AdminRequest { + Some(b) if b => "CipherMiniResponse", + _ => "CipherResponse", + }; Ok(Json(json!({ // AttachmentUploadDataResponseModel "Object": "attachment-fileUpload", "AttachmentId": attachment_id, "Url": url, "FileUploadType": FileUploadType::Direct as i32, - "CipherResponse": cipher.to_json(&headers.host, &headers.user.uuid, &conn), - "CipherMiniResponse": null, + response_key: cipher.to_json(&headers.host, &headers.user.uuid, &conn), }))) } From dd98fe860b33f8e34c161f49e3f6b07908d1dc3e Mon Sep 17 00:00:00 2001 From: Fabian Thies Date: Tue, 3 Aug 2021 17:33:59 +0200 Subject: [PATCH 4/9] Send create, update and delete notifications for `Send`s in the correct format. Add endpoints to get all sends or a specific send by its uuid. --- src/api/core/sends.rs | 38 +++++++++++++++++++++++++++++++++----- src/api/notifications.rs | 19 ++++++++++++++++++- src/db/models/send.rs | 11 +++++++---- 3 files changed, 58 insertions(+), 10 deletions(-) diff --git a/src/api/core/sends.rs b/src/api/core/sends.rs index df8b2d3c..0379deb5 100644 --- a/src/api/core/sends.rs +++ b/src/api/core/sends.rs @@ -18,6 +18,8 @@ const SEND_INACCESSIBLE_MSG: &str = "Send does not exist or is no longer availab pub fn routes() -> Vec { routes![ + get_sends, + get_send, post_send, post_send_file, post_access, @@ -128,6 +130,32 @@ fn create_send(data: SendData, user_uuid: String) -> ApiResult { Ok(send) } +#[get("/sends")] +fn get_sends(headers: Headers, conn: DbConn) -> Json { + let sends = Send::find_by_user(&headers.user.uuid, &conn); + let sends_json: Vec = sends.iter().map(|s| s.to_json()).collect(); + + Json(json!({ + "Data": sends_json, + "Object": "list", + "ContinuationToken": null + })) +} + +#[get("/sends/")] +fn get_send(uuid: String, headers: Headers, conn: DbConn) -> JsonResult { + let send = match Send::find_by_uuid(&uuid, &conn) { + Some(send) => send, + None => err!("Send not found"), + }; + + if send.user_uuid.as_ref() != Some(&headers.user.uuid) { + err!("Send is not owned by user") + } + + Ok(Json(send.to_json())) +} + #[post("/sends", data = "")] fn post_send(data: JsonUpcase, headers: Headers, conn: DbConn, nt: Notify) -> JsonResult { enforce_disable_send_policy(&headers, &conn)?; @@ -141,7 +169,7 @@ fn post_send(data: JsonUpcase, headers: Headers, conn: DbConn, nt: Not let mut send = create_send(data, headers.user.uuid.clone())?; send.save(&conn)?; - nt.send_user_update(UpdateType::SyncSendCreate, &headers.user); + nt.send_send_update(UpdateType::SyncSendCreate, &send, &send.update_users_revision(&conn)); Ok(Json(send.to_json())) } @@ -225,7 +253,7 @@ fn post_send_file(data: Data, content_type: &ContentType, headers: Headers, conn // Save the changes in the database send.save(&conn)?; - nt.send_user_update(UpdateType::SyncSendCreate, &headers.user); + nt.send_send_update(UpdateType::SyncSendUpdate, &send, &send.update_users_revision(&conn)); Ok(Json(send.to_json())) } @@ -397,7 +425,7 @@ fn put_send(id: String, data: JsonUpcase, headers: Headers, conn: DbCo } send.save(&conn)?; - nt.send_user_update(UpdateType::SyncSendUpdate, &headers.user); + nt.send_send_update(UpdateType::SyncSendUpdate, &send, &send.update_users_revision(&conn)); Ok(Json(send.to_json())) } @@ -414,7 +442,7 @@ fn delete_send(id: String, headers: Headers, conn: DbConn, nt: Notify) -> EmptyR } send.delete(&conn)?; - nt.send_user_update(UpdateType::SyncSendDelete, &headers.user); + nt.send_send_update(UpdateType::SyncSendDelete, &send, &send.update_users_revision(&conn)); Ok(()) } @@ -434,7 +462,7 @@ fn put_remove_password(id: String, headers: Headers, conn: DbConn, nt: Notify) - send.set_password(None); send.save(&conn)?; - nt.send_user_update(UpdateType::SyncSendUpdate, &headers.user); + nt.send_send_update(UpdateType::SyncSendUpdate, &send, &send.update_users_revision(&conn)); Ok(Json(send.to_json())) } diff --git a/src/api/notifications.rs b/src/api/notifications.rs index e184d528..e7b4a1e6 100644 --- a/src/api/notifications.rs +++ b/src/api/notifications.rs @@ -65,7 +65,7 @@ use chashmap::CHashMap; use chrono::NaiveDateTime; use serde_json::from_str; -use crate::db::models::{Cipher, Folder, User}; +use crate::db::models::{Cipher, Folder, User, Send}; use rmpv::Value; @@ -335,6 +335,23 @@ impl WebSocketUsers { self.send_update(uuid, &data).ok(); } } + + pub fn send_send_update(&self, ut: UpdateType, send: &Send, user_uuids: &[String]) { + let user_uuid = convert_option(send.user_uuid.clone()); + + let data = create_update( + vec![ + ("Id".into(), send.uuid.clone().into()), + ("UserId".into(), user_uuid), + ("RevisionDate".into(), serialize_date(send.revision_date)), + ], + ut, + ); + + for uuid in user_uuids { + self.send_update(uuid, &data).ok(); + } + } } /* Message Structure diff --git a/src/db/models/send.rs b/src/db/models/send.rs index 1fae40c8..05d366e4 100644 --- a/src/db/models/send.rs +++ b/src/db/models/send.rs @@ -232,15 +232,18 @@ impl Send { } } - pub fn update_users_revision(&self, conn: &DbConn) { - match &self.user_uuid { - Some(user_uuid) => { + pub fn update_users_revision(&self, conn: &DbConn) -> Vec { + let mut user_uuids = Vec::new(); + match self.user_uuid { + Some(ref user_uuid) => { User::update_uuid_revision(user_uuid, conn); + user_uuids.push(user_uuid.clone()) } None => { // Belongs to Organization, not implemented } - } + }; + user_uuids } pub fn delete_all_by_user(user_uuid: &str, conn: &DbConn) -> EmptyResult { From 42ba817a4c423457a014f13cec3faba994770b21 Mon Sep 17 00:00:00 2001 From: Fabian Thies Date: Wed, 4 Aug 2021 13:25:41 +0200 Subject: [PATCH 5/9] Fix errors that occurred in the nightly build --- src/api/core/sends.rs | 4 ++-- src/db/models/send.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/api/core/sends.rs b/src/api/core/sends.rs index 0379deb5..aa4fd792 100644 --- a/src/api/core/sends.rs +++ b/src/api/core/sends.rs @@ -167,7 +167,7 @@ fn post_send(data: JsonUpcase, headers: Headers, conn: DbConn, nt: Not err!("File sends should use /api/sends/file") } - let mut send = create_send(data, headers.user.uuid.clone())?; + let mut send = create_send(data, headers.user.uuid)?; send.save(&conn)?; nt.send_send_update(UpdateType::SyncSendCreate, &send, &send.update_users_revision(&conn)); @@ -210,7 +210,7 @@ fn post_send_file(data: Data, content_type: &ContentType, headers: Headers, conn }; // Create the Send - let mut send = create_send(data.data, headers.user.uuid.clone())?; + let mut send = create_send(data.data, headers.user.uuid)?; let file_id = crate::crypto::generate_send_id(); if send.atype != SendType::File as i32 { diff --git a/src/db/models/send.rs b/src/db/models/send.rs index 05d366e4..9cfb7b1e 100644 --- a/src/db/models/send.rs +++ b/src/db/models/send.rs @@ -234,8 +234,8 @@ impl Send { pub fn update_users_revision(&self, conn: &DbConn) -> Vec { let mut user_uuids = Vec::new(); - match self.user_uuid { - Some(ref user_uuid) => { + match &self.user_uuid { + Some(user_uuid) => { User::update_uuid_revision(user_uuid, conn); user_uuids.push(user_uuid.clone()) } From 1f0f64d961cd8839bcd5be6336f68d44b40aaa21 Mon Sep 17 00:00:00 2001 From: Fabian Thies Date: Wed, 4 Aug 2021 16:56:43 +0200 Subject: [PATCH 6/9] Sort the imports in notifications.rs alphabetically --- src/api/notifications.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/notifications.rs b/src/api/notifications.rs index e7b4a1e6..56985070 100644 --- a/src/api/notifications.rs +++ b/src/api/notifications.rs @@ -65,7 +65,7 @@ use chashmap::CHashMap; use chrono::NaiveDateTime; use serde_json::from_str; -use crate::db::models::{Cipher, Folder, User, Send}; +use crate::db::models::{Cipher, Folder, Send, User}; use rmpv::Value; From f6bd8b3462dcc77be81f5722c7be82b84478f522 Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 6 Aug 2021 13:39:33 +0200 Subject: [PATCH 7/9] Adding tzdata to container To be able to set a timezone inside a container with the env variable TZ the tzdata package is needed. Otherwise only UTC will be set. --- docker/Dockerfile.j2 | 1 + docker/amd64/Dockerfile.alpine | 1 + docker/armv7/Dockerfile.alpine | 1 + 3 files changed, 3 insertions(+) diff --git a/docker/Dockerfile.j2 b/docker/Dockerfile.j2 index 1787c932..8224644f 100644 --- a/docker/Dockerfile.j2 +++ b/docker/Dockerfile.j2 @@ -212,6 +212,7 @@ RUN mkdir /data \ {% if "alpine" in runtime_stage_base_image %} && apk add --no-cache \ openssl \ + tzdata \ curl \ dumb-init \ {% if "mysql" in features %} diff --git a/docker/amd64/Dockerfile.alpine b/docker/amd64/Dockerfile.alpine index a056b960..3e4603ab 100644 --- a/docker/amd64/Dockerfile.alpine +++ b/docker/amd64/Dockerfile.alpine @@ -82,6 +82,7 @@ ENV SSL_CERT_DIR=/etc/ssl/certs RUN mkdir /data \ && apk add --no-cache \ openssl \ + tzdata \ curl \ dumb-init \ postgresql-libs \ diff --git a/docker/armv7/Dockerfile.alpine b/docker/armv7/Dockerfile.alpine index 6a42d23e..a6ca1582 100644 --- a/docker/armv7/Dockerfile.alpine +++ b/docker/armv7/Dockerfile.alpine @@ -88,6 +88,7 @@ RUN [ "cross-build-start" ] RUN mkdir /data \ && apk add --no-cache \ openssl \ + tzdata \ curl \ dumb-init \ ca-certificates From 56b4f46d7d9c818a392d3ab62322302ed8b0c723 Mon Sep 17 00:00:00 2001 From: Jeremy Lin Date: Mon, 16 Aug 2021 22:23:33 -0700 Subject: [PATCH 8/9] Fix limitation on sharing ciphers with attachments This check is several years old, so maybe there was a valid reason for having it before, but it's not correct anymore. --- src/api/core/ciphers.rs | 6 ------ src/db/models/attachment.rs | 10 ---------- 2 files changed, 16 deletions(-) diff --git a/src/api/core/ciphers.rs b/src/api/core/ciphers.rs index f9133bec..8fc1137a 100644 --- a/src/api/core/ciphers.rs +++ b/src/api/core/ciphers.rs @@ -687,12 +687,6 @@ fn put_cipher_share_selected( }; } - let attachments = Attachment::find_by_ciphers(cipher_ids, &conn); - - if !attachments.is_empty() { - err!("Ciphers should not have any attachments.") - } - while let Some(cipher) = data.Ciphers.pop() { let mut shared_cipher_data = ShareCipherData { Cipher: cipher, diff --git a/src/db/models/attachment.rs b/src/db/models/attachment.rs index 04ad8990..bb0f9395 100644 --- a/src/db/models/attachment.rs +++ b/src/db/models/attachment.rs @@ -143,16 +143,6 @@ impl Attachment { }} } - pub fn find_by_ciphers(cipher_uuids: Vec, conn: &DbConn) -> Vec { - db_run! { conn: { - attachments::table - .filter(attachments::cipher_uuid.eq_any(cipher_uuids)) - .load::(conn) - .expect("Error loading attachments") - .from_db() - }} - } - pub fn size_by_user(user_uuid: &str, conn: &DbConn) -> i64 { db_run! { conn: { let result: Option = attachments::table From 881d1f43340b16cfa6b9836b520537461397c1d3 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Thu, 19 Aug 2021 09:25:34 +0200 Subject: [PATCH 9/9] Fix wrong display of MFA email. There was some wrong logic regarding the display of which email is configured to be used for the email MFA. This is now fixed. Resolves #1878 --- src/api/core/two_factor/email.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/api/core/two_factor/email.rs b/src/api/core/two_factor/email.rs index f9b03499..998aeccf 100644 --- a/src/api/core/two_factor/email.rs +++ b/src/api/core/two_factor/email.rs @@ -80,14 +80,16 @@ fn get_email(data: JsonUpcase, headers: Headers, conn: DbConn) -> err!("Invalid password"); } - let type_ = TwoFactorType::Email as i32; - let enabled = match TwoFactor::find_by_user_and_type(&user.uuid, type_, &conn) { - Some(x) => x.enabled, - _ => false, + let (enabled, mfa_email) = match TwoFactor::find_by_user_and_type(&user.uuid, TwoFactorType::Email as i32, &conn) { + Some(x) => { + let twofactor_data = EmailTokenData::from_json(&x.data)?; + (true, json!(twofactor_data.email)) + } + _ => (false, json!(null)), }; Ok(Json(json!({ - "Email": user.email, + "Email": mfa_email, "Enabled": enabled, "Object": "twoFactorEmail" })))