diff --git a/Cargo.lock b/Cargo.lock index 3d006eef3da7ab0cd291a5a36ecd54c255cc335b..7e2e1c2eb9c2cd41bdf84fc1baeac8b82c8f3c69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -42,7 +42,7 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5" dependencies = [ - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -167,7 +167,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -181,7 +181,7 @@ dependencies = [ "futures-io", "futures-util", "log", - "pin-project 1.0.4", + "pin-project 1.0.5", "tungstenite", ] @@ -364,9 +364,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07aa6688c702439a1be0307b6a94dffe1168569e45b9500c1372bc580740d59" +checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" [[package]] name = "byte-tools" @@ -514,6 +514,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "ctor" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8f45d9ad417bcef4817d614a501ab55cdd96a6fdb24f49aab89a54acfd66b19" +dependencies = [ + "quote 1.0.9", + "syn 1.0.60", +] + [[package]] name = "ctrlc" version = "3.1.7" @@ -543,7 +553,7 @@ dependencies = [ "fnv", "ident_case", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "strsim 0.9.3", "syn 1.0.60", ] @@ -555,7 +565,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ "darling_core", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -566,7 +576,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -585,7 +595,7 @@ version = "0.3.0" source = "git+https://github.com/SergioBenitez/Devise.git?rev=3648468#3648468a9ede9ca896cd35bc1eb818c7a9fb3047" dependencies = [ "devise_core", - "quote 1.0.8", + "quote 1.0.9", ] [[package]] @@ -596,7 +606,7 @@ dependencies = [ "bitflags", "proc-macro2 1.0.24", "proc-macro2-diagnostics", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -644,9 +654,9 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "encoding_rs" -version = "0.8.26" +version = "0.8.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283" +checksum = "80df024fbc5ac80f87dfef0d9f5209a252f2a497f7f42944cff24d8253cac065" dependencies = [ "cfg-if 1.0.0", ] @@ -659,7 +669,7 @@ checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" dependencies = [ "heck", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -684,7 +694,7 @@ checksum = "22deed3a8124cff5fa835713fa105621e43bbdc46690c3a6b68328a012d350d4" dependencies = [ "proc-macro-error", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "rustversion", "syn 1.0.60", "synstructure", @@ -865,7 +875,7 @@ checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -990,6 +1000,20 @@ dependencies = [ "tracing-futures", ] +[[package]] +name = "handlebars" +version = "3.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "964d0e99a61fe9b1b347389b77ebf8b7e1587b70293676aaca7d27e59b9073b2" +dependencies = [ + "log", + "pest", + "pest_derive", + "quick-error 2.0.0", + "serde", + "serde_json", +] + [[package]] name = "hashbrown" version = "0.9.1" @@ -1078,9 +1102,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "httpdate" @@ -1094,14 +1118,14 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" dependencies = [ - "quick-error", + "quick-error 1.2.3", ] [[package]] name = "hyper" -version = "0.13.9" +version = "0.13.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" +checksum = "8a6f157065790a3ed2f88679250419b5cdd96e714a0d65f7797fd337186e96bb" dependencies = [ "bytes 0.5.6", "futures-channel", @@ -1113,7 +1137,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 1.0.4", + "pin-project 1.0.5", "socket2", "tokio", "tower-service", @@ -1175,9 +1199,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" dependencies = [ "matches", "unicode-bidi", @@ -1311,9 +1335,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lettre" -version = "0.10.0-alpha.4" +version = "0.10.0-alpha.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc8c2fc7873920aca23647e5e86d44ff3f40bbc5a5efaab445c9eb0e001c9f71" +checksum = "34f3dd8d917156976a47ef421a2e771423d6da95e93696f1814e76768625c162" dependencies = [ "base64 0.13.0", "hostname", @@ -1325,7 +1349,7 @@ dependencies = [ "once_cell", "quoted_printable", "r2d2", - "rand 0.7.3", + "rand 0.8.3", "regex", "serde", "serde_json", @@ -1334,9 +1358,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.82" +version = "0.2.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89203f3fba0a3795506acaad8ebce3c80c0af93f994d5a1d7a0b1eeb23271929" +checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" [[package]] name = "linked-hash-map" @@ -1364,11 +1388,12 @@ dependencies = [ [[package]] name = "log" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", + "value-bag", ] [[package]] @@ -1386,6 +1411,12 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff2806c88ab7215e5077fbaaf21a9baaab9caa2abd7adf6c0f63b535ad747547" +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + [[package]] name = "match_cfg" version = "0.1.0" @@ -1653,7 +1684,7 @@ checksum = "1c0fd9eba1d5db0994a239e09c1be402d35622277e35468ba891aa5e3188ce7e" dependencies = [ "proc-macro-crate", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -1808,7 +1839,7 @@ checksum = "602cf1780ee9bbca663ea75769e05643e16fe87d7c8ac9f4f385a2ed8940a75c" dependencies = [ "proc-macro2 1.0.24", "proc-macro2-diagnostics", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -1818,6 +1849,49 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.60", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1 0.8.2", +] + [[package]] name = "pin-project" version = "0.4.27" @@ -1829,11 +1903,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b70b68509f17aa2857863b6fa00bf21fc93674c7a8893de2f469f6aa7ca2f2" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" dependencies = [ - "pin-project-internal 1.0.4", + "pin-project-internal 1.0.5", ] [[package]] @@ -1843,18 +1917,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65ad2ae56b6abe3a1ee25f15ee605bacadb9a764edaba9c2bf4103800d4a1895" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] [[package]] name = "pin-project-internal" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caa25a6393f22ce819b0f50e0be89287292fda8d425be38ee0ca14c4931d9e71" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -1918,7 +1992,7 @@ checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", "version_check", ] @@ -1930,7 +2004,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "version_check", ] @@ -1971,7 +2045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", "version_check", "yansi", @@ -1997,6 +2071,12 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quick-error" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ac73b1112776fc109b2e61909bc46c7e1bf0d7f690ffb1676553acce16d5cda" + [[package]] name = "quote" version = "0.6.13" @@ -2008,9 +2088,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" dependencies = [ "proc-macro2 1.0.24", ] @@ -2072,9 +2152,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", "rand_chacha 0.3.0", @@ -2228,10 +2308,11 @@ dependencies = [ [[package]] name = "rauth" -version = "0.2.1" -source = "git+https://gitlab.insrt.uk/insert/rauth?rev=d48b0087cc546d2c9ef53f27d0693c8378172dfe#d48b0087cc546d2c9ef53f27d0693c8378172dfe" +version = "0.2.2" +source = "git+https://gitlab.insrt.uk/insert/rauth?rev=1e5f671144772a28f3faac55dd98647235736923#1e5f671144772a28f3faac55dd98647235736923" dependencies = [ "chrono", + "handlebars", "json", "lazy_static", "lettre", @@ -2242,6 +2323,7 @@ dependencies = [ "rocket_contrib", "rust-argon2", "serde", + "serde_json", "snafu", "tokio", "ulid", @@ -2288,7 +2370,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c38e3aecd2b21cb3959637b883bb3714bc7e43f0268b9a29d3743ee3e55cdd2" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -2366,12 +2448,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" dependencies = [ "hostname", - "quick-error", + "quick-error 1.2.3", ] [[package]] name = "revolt" -version = "0.3.3-alpha.0" +version = "0.3.3-alpha.2" dependencies = [ "async-std", "async-tungstenite", @@ -2410,9 +2492,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.19" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", "libc", @@ -2460,7 +2542,7 @@ dependencies = [ "devise", "glob", "indexmap", - "quote 1.0.8", + "quote 1.0.9", "rocket_http", ] @@ -2665,9 +2747,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.122" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "974ef1bd2ad8a507599b336595454081ff68a9599b4890af7643c0c0ed73a62c" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" dependencies = [ "serde_derive", ] @@ -2683,20 +2765,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.122" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dee1f300f838c8ac340ecb0112b3ac472464fa67e87292bdb3dfc9c49128e17" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] [[package]] name = "serde_json" -version = "1.0.61" +version = "1.0.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +checksum = "ea1c6153794552ea7cf7cf63b1231a25de00ec90db326ba6264440fa08e31486" dependencies = [ "indexmap", "itoa", @@ -2718,9 +2800,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "012c1e1750318ba7d775e4104e34a4eca896b0016e6b90370f12381a28fb29f0" +checksum = "42fa8fb0da0bf5aa7dd5d8fe1f9ec769833eb7cf97ff89942903809e600de908" dependencies = [ "serde", "serde_with_macros", @@ -2734,7 +2816,7 @@ checksum = "1197ff7de45494f290c1e3e1a6f80e108974681984c87a3e480991ef3d0f1950" dependencies = [ "darling", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -2752,9 +2834,9 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3cdf1b5e620a498ee6f2a171885ac7e22f0e12089ec4b3d22b84921792507c" +checksum = "f4b312c3731e3fe78a185e6b9b911a7aa715b8e31cce117975219aab2acf285d" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", @@ -2819,7 +2901,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -2842,9 +2924,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "standback" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66a8cff4fa24853fdf6b51f75c6d7f8206d7c75cab4e467bcd7f25c2b1febe0" +checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8" dependencies = [ "version_check", ] @@ -2876,7 +2958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "serde", "serde_derive", "syn 1.0.60", @@ -2890,7 +2972,7 @@ checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" dependencies = [ "base-x", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "serde", "serde_derive", "serde_json", @@ -2950,7 +3032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "unicode-xid 0.2.1", ] @@ -2961,7 +3043,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b834f2d66f734cb897113e34aaff2f1ab4719ca946f9a7358dba8f8064148701" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", "unicode-xid 0.2.1", ] @@ -2986,7 +3068,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.2", + "rand 0.8.3", "redox_syscall 0.2.4", "remove_dir_all", "winapi 0.3.9", @@ -3017,15 +3099,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] [[package]] name = "thread_local" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" dependencies = [ "once_cell", ] @@ -3074,16 +3156,16 @@ checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" dependencies = [ "proc-macro-hack", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "standback", "syn 1.0.60", ] [[package]] name = "tinyvec" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +checksum = "317cca572a0e89c3ce0ca1f1bdc9369547fe318a683418e42ac8f59d14701023" dependencies = [ "tinyvec_macros", ] @@ -3096,9 +3178,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "0.2.24" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48" +checksum = "6703a273949a90131b290be1fe7b039d0fc884aa1935860dfcbe056f28cd8092" dependencies = [ "bytes 0.5.6", "fnv", @@ -3124,7 +3206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", ] @@ -3193,9 +3275,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" [[package]] name = "tracing" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" +checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3" dependencies = [ "cfg-if 1.0.0", "log", @@ -3282,7 +3364,7 @@ dependencies = [ "input_buffer", "log", "rand 0.7.3", - "sha-1 0.9.2", + "sha-1 0.9.3", "url", "utf-8", ] @@ -3313,6 +3395,12 @@ dependencies = [ "serde", ] +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "ulid" version = "0.4.1" @@ -3363,9 +3451,9 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +checksum = "07fbfce1c8a97d547e8b5334978438d9d6ec8c20e38f56d4a4374d181493eaef" dependencies = [ "tinyvec", ] @@ -3454,7 +3542,7 @@ dependencies = [ "lazy_static", "proc-macro-error", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "regex", "syn 1.0.60", "validator_types", @@ -3466,6 +3554,15 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "add324da7950ac1f76b1c16ce8b5406147953d5d6a2ac1c5da93785f2cfc738b" +[[package]] +name = "value-bag" +version = "1.0.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b676010e055c99033117c2343b33a40a30b91fecd6c49055ac9cd2d6c305ab1" +dependencies = [ + "ctor", +] + [[package]] name = "vcpkg" version = "0.2.11" @@ -3534,7 +3631,7 @@ dependencies = [ "lazy_static", "log", "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", "wasm-bindgen-shared", ] @@ -3557,7 +3654,7 @@ version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" dependencies = [ - "quote 1.0.8", + "quote 1.0.9", "wasm-bindgen-macro-support", ] @@ -3568,7 +3665,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" dependencies = [ "proc-macro2 1.0.24", - "quote 1.0.8", + "quote 1.0.9", "syn 1.0.60", "wasm-bindgen-backend", "wasm-bindgen-shared", diff --git a/Cargo.toml b/Cargo.toml index eb0080f4578854803c8da26f4703427309557de6..3b7f57b9563f8a698578b5eaebef7abbabbc907c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revolt" -version = "0.3.3-alpha.0" +version = "0.3.3-alpha.2" authors = ["Paul Makles <paulmakles@gmail.com>"] edition = "2018" @@ -13,7 +13,7 @@ many-to-many = "0.1.2" ctrlc = { version = "3.0", features = ["termination"] } async-std = { version = "1.8.0", features = ["tokio02", "attributes"] } async-tungstenite = { version = "0.10.0", features = ["async-std-runtime"] } -rauth = { git = "https://gitlab.insrt.uk/insert/rauth", rev = "d48b0087cc546d2c9ef53f27d0693c8378172dfe" } +rauth = { git = "https://gitlab.insrt.uk/insert/rauth", rev = "1e5f671144772a28f3faac55dd98647235736923" } hive_pubsub = { version = "0.4.3", features = ["mongo"] } rocket_cors = { git = "https://github.com/insertish/rocket_cors", branch = "master" } diff --git a/assets/templates/reset.html b/assets/templates/reset.html new file mode 100644 index 0000000000000000000000000000000000000000..5157f09be0326225c4ba4484d1471588b1d6b51a --- /dev/null +++ b/assets/templates/reset.html @@ -0,0 +1,62 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Reset your password.</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + + <style type="text/css"> + a[x-apple-data-detectors] {color: inherit !important;} + </style> + +</head> +<body style="margin: 0; padding: 0;"> + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td style="padding: 20px 0 30px 0;"> + +<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse; border: 1px solid #cccccc;"> + <tr> + <td align="center" bgcolor="#ff4654"> + <img src="https://revolt.chat/header.png" alt="REVOLT logo" width="600" height="168" style="display: block;" /> + </td> + </tr> + <tr> + <td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;"> + <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> + <tr> + <td style="color: #153643; font-family: Arial, sans-serif;"> + <h1 style="font-size: 24px; margin: 0;">Reset your password!</h1> + </td> + </tr> + <tr> + <td style="color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 24px; padding: 20px 0 0 0;"> + <p style="margin: 0;"> + Reset your password by <a href="{{url}}">clicking here</a>. + </p> + <p> + Or by manually navigating to the URL: {{url}} + </p> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td bgcolor="#ff4654" style="padding: 30px 30px;"> + <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> + <tr> + <td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;"> + <p style="margin: 0;">Sent by REVOLT. · <a style="color: white;" href="https://revolt.chat">Website</a> · <a style="color: white;" href="https://gitlab.insrt.uk/revolt">Source Code</a></p> + </td> + </tr> + </table> + </td> + </tr> +</table> + + </td> + </tr> + </table> +</body> +</html> \ No newline at end of file diff --git a/assets/templates/verify.html b/assets/templates/verify.html new file mode 100644 index 0000000000000000000000000000000000000000..c02ea6eb3690dd191d662f8499e519769b0dc14d --- /dev/null +++ b/assets/templates/verify.html @@ -0,0 +1,62 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en-GB"> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>Verify your account.</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> + + <style type="text/css"> + a[x-apple-data-detectors] {color: inherit !important;} + </style> + +</head> +<body style="margin: 0; padding: 0;"> + <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="100%"> + <tr> + <td style="padding: 20px 0 30px 0;"> + +<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse; border: 1px solid #cccccc;"> + <tr> + <td align="center" bgcolor="#ff4654"> + <img src="https://revolt.chat/header.png" alt="REVOLT logo" width="600" height="168" style="display: block;" /> + </td> + </tr> + <tr> + <td bgcolor="#ffffff" style="padding: 40px 30px 40px 30px;"> + <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> + <tr> + <td style="color: #153643; font-family: Arial, sans-serif;"> + <h1 style="font-size: 24px; margin: 0;">Verify your account!</h1> + </td> + </tr> + <tr> + <td style="color: #153643; font-family: Arial, sans-serif; font-size: 16px; line-height: 24px; padding: 20px 0 0 0;"> + <p style="margin: 0;"> + Please verify your account by <a href="{{url}}">clicking here</a>. + </p> + <p> + Or by manually navigating to the URL: {{url}} + </p> + </td> + </tr> + </table> + </td> + </tr> + <tr> + <td bgcolor="#ff4654" style="padding: 30px 30px;"> + <table border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;"> + <tr> + <td style="color: #ffffff; font-family: Arial, sans-serif; font-size: 14px;"> + <p style="margin: 0;">Sent by REVOLT. · <a style="color: white;" href="https://revolt.chat">Website</a> · <a style="color: white;" href="https://gitlab.insrt.uk/revolt">Source Code</a></p> + </td> + </tr> + </table> + </td> + </tr> +</table> + + </td> + </tr> + </table> +</body> +</html> \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index a8ab180cdb96080beab61c75332357d7662170a0..aa0bc4d49f693f93168a2ae81a27d23c6af7949f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,12 +21,12 @@ pub mod util; use chrono::Duration; use futures::join; use log::info; -use rauth::auth::Auth; +use rauth::{auth::Auth, options::{Template, Templates}}; use rauth::options::{EmailVerification, Options, SMTP}; use rocket_cors::AllowedOrigins; use rocket_prometheus::PrometheusMetrics; use util::variables::{ - PUBLIC_URL, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD, SMTP_USERNAME, USE_EMAIL, USE_PROMETHEUS, + PUBLIC_URL, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD, SMTP_USERNAME, USE_EMAIL, USE_PROMETHEUS, APP_URL }; #[async_std::main] @@ -67,9 +67,26 @@ async fn launch_web() { .base_url(format!("{}/auth", *PUBLIC_URL)) .email_verification(if *USE_EMAIL { EmailVerification::Enabled { - success_redirect_uri: format!("{}/welcome", *PUBLIC_URL), + success_redirect_uri: format!("{}/login", *APP_URL), + welcome_redirect_uri: format!("{}/welcome", *APP_URL), + password_reset_url: Some(format!("{}/login/reset", *APP_URL)), + verification_expiry: Duration::days(1), - verification_ratelimit: Duration::minutes(1), + password_reset_expiry: Duration::hours(1), + + templates: Templates { + verify_email: Template { + title: "Verify your REVOLT account.", + text: "Verify your email here: {{url}}", + html: include_str!("../assets/templates/verify.html") + }, + reset_password: Template { + title: "Reset your REVOLT password.", + text: "Reset your password here: {{url}}", + html: include_str!("../assets/templates/reset.html") + }, + welcome: None + }, smtp: SMTP { from: (*SMTP_FROM).to_string(), diff --git a/src/routes/root.rs b/src/routes/root.rs index aa67259734d08a42e529838dbdd6fcf7998725ee..a247f8abcfca4c5dc4581835199cec59bc232e9f 100644 --- a/src/routes/root.rs +++ b/src/routes/root.rs @@ -8,7 +8,7 @@ use rocket_contrib::json::JsonValue; #[get("/")] pub async fn root() -> JsonValue { json!({ - "revolt": "0.3.3-alpha.0", + "revolt": "0.3.3-alpha.2", "features": { "registration": !*DISABLE_REGISTRATION, "captcha": { diff --git a/src/util/captcha.rs b/src/util/captcha.rs deleted file mode 100644 index e8df55685a3421ae2eb09a2982852ca84e89391e..0000000000000000000000000000000000000000 --- a/src/util/captcha.rs +++ /dev/null @@ -1,45 +0,0 @@ -use crate::util::variables::{HCAPTCHA_KEY, USE_HCAPTCHA}; - -use reqwest::Client; -use serde::{Deserialize, Serialize}; -use std::collections::HashMap; - -#[derive(Serialize, Deserialize)] -struct CaptchaResponse { - success: bool, -} - -pub async fn verify(user_token: &Option<String>) -> Result<(), String> { - if *USE_HCAPTCHA { - if let Some(token) = user_token { - let mut map = HashMap::new(); - map.insert("secret", HCAPTCHA_KEY.to_string()); - map.insert("response", token.to_string()); - - let client = Client::new(); - if let Ok(response) = client - .post("https://hcaptcha.com/siteverify") - .form(&map) - .send() - .await - { - let result: CaptchaResponse = response - .json() - .await - .map_err(|_| "Failed to deserialise captcha result.".to_string())?; - - if result.success { - Ok(()) - } else { - Err("Unsuccessful captcha verification".to_string()) - } - } else { - Err("Failed to verify with hCaptcha".to_string()) - } - } else { - Err("Missing hCaptcha token!".to_string()) - } - } else { - Ok(()) - } -} diff --git a/src/util/email.rs b/src/util/email.rs deleted file mode 100644 index c21599919f270bb4371df45dfa85ee08007799c5..0000000000000000000000000000000000000000 --- a/src/util/email.rs +++ /dev/null @@ -1,96 +0,0 @@ -use lettre::message::{header, MultiPart, SinglePart}; -use lettre::transport::smtp::authentication::Credentials; -use lettre::{Message, SmtpTransport, Transport}; - -use super::variables::{PUBLIC_URL, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD, SMTP_USERNAME}; - -lazy_static! { - static ref MAILER: lettre::transport::smtp::SmtpTransport = - SmtpTransport::relay(SMTP_HOST.as_ref()) - .unwrap() - .credentials(Credentials::new( - SMTP_USERNAME.to_string(), - SMTP_PASSWORD.to_string() - )) - .build(); -} - -fn send(message: Message) -> Result<(), String> { - MAILER - .send(&message) - .map_err(|err| format!("Failed to send email! {}", err.to_string()))?; - - Ok(()) -} - -fn generate_multipart(text: &str, html: &str) -> MultiPart { - MultiPart::mixed().multipart( - MultiPart::alternative() - .singlepart( - SinglePart::quoted_printable() - .header(header::ContentType( - "text/plain; charset=utf8".parse().unwrap(), - )) - .body(text), - ) - .multipart( - MultiPart::related().singlepart( - SinglePart::eight_bit() - .header(header::ContentType( - "text/html; charset=utf8".parse().unwrap(), - )) - .body(html), - ), - ), - ) -} - -pub fn send_verification_email(email: String, code: String) -> Result<(), String> { - let url = format!("{}/api/account/verify/{}", PUBLIC_URL.to_string(), code); - let email = Message::builder() - .from(SMTP_FROM.to_string().parse().unwrap()) - .to(email.parse().unwrap()) - .subject("Verify your email!") - .multipart(generate_multipart( - &format!("Verify your email here: {}", url), - &format!("<a href=\"{}\">Click to verify your email!</a>", url), - )) - .unwrap(); - - send(email) -} - -pub fn send_password_reset(email: String, code: String) -> Result<(), String> { - let url = format!("{}/api/account/reset/{}", PUBLIC_URL.to_string(), code); - let email = Message::builder() - .from(SMTP_FROM.to_string().parse().unwrap()) - .to(email.parse().unwrap()) - .subject("Reset your password.") - .multipart(generate_multipart( - &format!("Reset your password here: {}", url), - &format!("<a href=\"{}\">Click to reset your password!</a>", url), - )) - .unwrap(); - - send(email) -} - -pub fn send_welcome_email(email: String, username: String) -> Result<(), String> { - let email = Message::builder() - .from(SMTP_FROM.to_string().parse().unwrap()) - .to(email.parse().unwrap()) - .subject("Welcome to REVOLT!") - .multipart( - generate_multipart( - &format!("Welcome, {}! You can now use REVOLT.", username), - &format!( - "<b>Welcome, {}!</b><br/>You can now use REVOLT.<br/><a href=\"{}\">Go to REVOLT</a>", - username, - PUBLIC_URL.to_string() - ) - ) - ) - .unwrap(); - - send(email) -} diff --git a/src/util/mod.rs b/src/util/mod.rs index 28c904127cb036c719bd3e3b388665e67d861cdb..a22135dc198ddff54b3814e012eb1679de0fd5e9 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -2,8 +2,6 @@ use rand::{distributions::Alphanumeric, Rng}; use std::collections::HashSet; use std::iter::FromIterator; -pub mod captcha; -pub mod email; pub mod result; pub mod variables; diff --git a/src/util/variables.rs b/src/util/variables.rs index cbf01ccc07ea454b048b1d25feb7888d78f14951..37acdce1aab5536888f0c749ab2291d827cc8f21 100644 --- a/src/util/variables.rs +++ b/src/util/variables.rs @@ -9,6 +9,8 @@ lazy_static! { env::var("REVOLT_MONGO_URI").expect("Missing REVOLT_MONGO_URI environment variable."); pub static ref PUBLIC_URL: String = env::var("REVOLT_PUBLIC_URL").expect("Missing REVOLT_PUBLIC_URL environment variable."); + pub static ref APP_URL: String = + env::var("REVOLT_APP_URL").unwrap_or_else(|_| "https://app.revolt.chat".to_string()); pub static ref EXTERNAL_WS_URL: String = env::var("REVOLT_EXTERNAL_WS_URL").expect("Missing REVOLT_EXTERNAL_WS_URL environment variable."); pub static ref HCAPTCHA_KEY: String =