Begin of mail reset (mail queue)
This commit is contained in:
parent
e3989e6108
commit
17c4552340
|
@ -76,6 +76,12 @@ version = "0.5.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8"
|
||||
|
||||
[[package]]
|
||||
name = "ascii_utils"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71938f30533e4d95a6d17aa530939da3842c2ab6f4f84b9dae68447e4129f74a"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.14"
|
||||
|
@ -87,6 +93,12 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
|
@ -103,6 +115,15 @@ dependencies = [
|
|||
"safemem",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.12.3"
|
||||
|
@ -156,6 +177,12 @@ dependencies = [
|
|||
"byte-tools",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bufstream"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8"
|
||||
|
||||
[[package]]
|
||||
name = "byte-tools"
|
||||
version = "0.3.1"
|
||||
|
@ -168,12 +195,24 @@ version = "1.3.4"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.66"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.15"
|
||||
|
@ -186,6 +225,15 @@ dependencies = [
|
|||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "config"
|
||||
version = "0.10.1"
|
||||
|
@ -193,7 +241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "19b076e143e1d9538dde65da30f8481c2a6c44040edb8e02b9bf1351edb92ce3"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"nom",
|
||||
"nom 5.1.2",
|
||||
"rust-ini",
|
||||
"serde 1.0.115",
|
||||
"serde-hjson",
|
||||
|
@ -219,19 +267,35 @@ dependencies = [
|
|||
"hkdf",
|
||||
"hmac",
|
||||
"percent-encoding 2.1.0",
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"sha2",
|
||||
"time",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation-sys"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b"
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.7.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"autocfg 1.0.1",
|
||||
"cfg-if 0.1.10",
|
||||
"lazy_static",
|
||||
]
|
||||
|
||||
|
@ -288,7 +352,7 @@ dependencies = [
|
|||
"chrono",
|
||||
"diesel_derives",
|
||||
"pq-sys",
|
||||
"uuid",
|
||||
"uuid 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -321,6 +385,85 @@ dependencies = [
|
|||
"generic-array",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "email"
|
||||
version = "0.0.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91549a51bb0241165f13d57fc4c72cef063b4088fb078b019ecbf464a45f22e4"
|
||||
dependencies = [
|
||||
"base64 0.9.3",
|
||||
"chrono",
|
||||
"encoding",
|
||||
"lazy_static",
|
||||
"rand 0.4.6",
|
||||
"time",
|
||||
"version_check 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding"
|
||||
version = "0.2.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
||||
dependencies = [
|
||||
"encoding-index-japanese",
|
||||
"encoding-index-korean",
|
||||
"encoding-index-simpchinese",
|
||||
"encoding-index-singlebyte",
|
||||
"encoding-index-tradchinese",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-japanese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-korean"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-simpchinese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-singlebyte"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding-index-tradchinese"
|
||||
version = "1.20141219.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
|
||||
dependencies = [
|
||||
"encoding_index_tests",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "encoding_index_tests"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.7.1"
|
||||
|
@ -344,15 +487,17 @@ dependencies = [
|
|||
"diesel_geometry",
|
||||
"env_logger",
|
||||
"iban_validate",
|
||||
"lettre",
|
||||
"lettre_email",
|
||||
"log 0.4.11",
|
||||
"rand",
|
||||
"rand 0.7.3",
|
||||
"rocket",
|
||||
"rocket_contrib",
|
||||
"rust-argon2",
|
||||
"serde 1.0.115",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"uuid",
|
||||
"uuid 0.8.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -361,18 +506,42 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed"
|
||||
|
||||
[[package]]
|
||||
name = "fast_chemail"
|
||||
version = "0.9.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "495a39d30d624c2caabe6312bfead73e7717692b44e0b32df168c275a2e8e9e4"
|
||||
dependencies = [
|
||||
"ascii_utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "filetime"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ed85775dcc68644b5c950ac06a2b23768d3bc9390464151aaf27136998dcf9e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
|
||||
dependencies = [
|
||||
"foreign-types-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "foreign-types-shared"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
|
||||
|
||||
[[package]]
|
||||
name = "fsevent"
|
||||
version = "0.4.0"
|
||||
|
@ -392,6 +561,12 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-cprng"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
|
||||
[[package]]
|
||||
name = "fuchsia-zircon"
|
||||
version = "0.3.3"
|
||||
|
@ -423,7 +598,7 @@ version = "0.1.14"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"wasi",
|
||||
]
|
||||
|
@ -466,7 +641,7 @@ version = "0.8.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"autocfg 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -498,6 +673,16 @@ dependencies = [
|
|||
"digest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hostname"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21ceb46a83a85e824ef93669c8b390009623863b5c195d1ba747292c0c72f94e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"winutil",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "httparse"
|
||||
version = "1.3.4"
|
||||
|
@ -523,7 +708,7 @@ dependencies = [
|
|||
"httparse",
|
||||
"language-tags",
|
||||
"log 0.3.9",
|
||||
"mime",
|
||||
"mime 0.2.6",
|
||||
"num_cpus",
|
||||
"time",
|
||||
"traitobject",
|
||||
|
@ -558,7 +743,7 @@ version = "1.5.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"autocfg 1.0.1",
|
||||
"hashbrown",
|
||||
]
|
||||
|
||||
|
@ -625,6 +810,38 @@ version = "1.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
||||
|
||||
[[package]]
|
||||
name = "lettre"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "338d9a248c4b3ef60c51941c678bb8f64e244c0a98f1eb71db027d1e777a5700"
|
||||
dependencies = [
|
||||
"base64 0.10.1",
|
||||
"bufstream",
|
||||
"fast_chemail",
|
||||
"hostname",
|
||||
"log 0.4.11",
|
||||
"native-tls",
|
||||
"nom 4.2.3",
|
||||
"serde 1.0.115",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lettre_email"
|
||||
version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd02480f8dcf48798e62113974d6ccca2129a51d241fa20f1ea349c8a42559d5"
|
||||
dependencies = [
|
||||
"base64 0.10.1",
|
||||
"email",
|
||||
"lettre",
|
||||
"mime 0.3.16",
|
||||
"time",
|
||||
"uuid 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lexical-core"
|
||||
version = "0.7.4"
|
||||
|
@ -633,7 +850,7 @@ checksum = "db65c6da02e61f55dae90a0ae427b2a5f6b3e8db09f58d10efab23af92592616"
|
|||
dependencies = [
|
||||
"arrayvec",
|
||||
"bitflags",
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"ryu",
|
||||
"static_assertions",
|
||||
]
|
||||
|
@ -675,7 +892,7 @@ version = "0.4.11"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -705,13 +922,19 @@ dependencies = [
|
|||
"log 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.6.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"fuchsia-zircon",
|
||||
"fuchsia-zircon-sys",
|
||||
"iovec",
|
||||
|
@ -748,17 +971,45 @@ dependencies = [
|
|||
"ws2_32-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "native-tls"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6fcc7939b5edc4e4f86b1b4a04bb1498afaaf871b1a6691838ed06fcb48d3a3f"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log 0.4.11",
|
||||
"openssl",
|
||||
"openssl-probe",
|
||||
"openssl-sys",
|
||||
"schannel",
|
||||
"security-framework",
|
||||
"security-framework-sys",
|
||||
"tempfile",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "net2"
|
||||
version = "0.2.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "4.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"version_check 0.1.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "5.1.2"
|
||||
|
@ -794,7 +1045,7 @@ version = "0.1.43"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"autocfg 1.0.1",
|
||||
"num-traits 0.2.12",
|
||||
]
|
||||
|
||||
|
@ -813,7 +1064,7 @@ version = "0.2.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"autocfg 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -832,6 +1083,39 @@ version = "0.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.32"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "038d43985d1ddca7a9900630d8cd031b56e4794eecc2e9ea39dd17aa04399a70"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cfg-if 1.0.0",
|
||||
"foreign-types",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"openssl-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl-probe"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.60"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "921fc71883267538946025deffb622905ecad223c28efbfdef9bb59a0175f3e6"
|
||||
dependencies = [
|
||||
"autocfg 1.0.1",
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pear"
|
||||
version = "0.1.4"
|
||||
|
@ -909,13 +1193,19 @@ dependencies = [
|
|||
"sha-1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
|
||||
[[package]]
|
||||
name = "polyval"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"cfg-if 0.1.10",
|
||||
"universal-hash",
|
||||
]
|
||||
|
||||
|
@ -976,6 +1266,38 @@ dependencies = [
|
|||
"proc-macro2 1.0.19",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
dependencies = [
|
||||
"fuchsia-cprng",
|
||||
"libc",
|
||||
"rand_core 0.3.1",
|
||||
"rdrand",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7",
|
||||
"libc",
|
||||
"rand_chacha 0.1.1",
|
||||
"rand_core 0.4.2",
|
||||
"rand_hc 0.1.0",
|
||||
"rand_isaac",
|
||||
"rand_jitter",
|
||||
"rand_os",
|
||||
"rand_pcg",
|
||||
"rand_xorshift",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.7.3"
|
||||
|
@ -984,9 +1306,19 @@ checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
|
|||
dependencies = [
|
||||
"getrandom",
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core",
|
||||
"rand_hc",
|
||||
"rand_chacha 0.2.2",
|
||||
"rand_core 0.5.1",
|
||||
"rand_hc 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7",
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -996,9 +1328,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
dependencies = [
|
||||
"rand_core 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.5.1"
|
||||
|
@ -1008,13 +1355,84 @@ dependencies = [
|
|||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
|
||||
dependencies = [
|
||||
"rand_core",
|
||||
"rand_core 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_isaac"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_jitter"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_os"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071"
|
||||
dependencies = [
|
||||
"cloudabi",
|
||||
"fuchsia-cprng",
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"rdrand",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_pcg"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44"
|
||||
dependencies = [
|
||||
"autocfg 0.1.7",
|
||||
"rand_core 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_xorshift"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rdrand"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
dependencies = [
|
||||
"rand_core 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1041,6 +1459,15 @@ version = "0.6.18"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8"
|
||||
|
||||
[[package]]
|
||||
name = "remove_dir_all"
|
||||
version = "0.5.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rocket"
|
||||
version = "0.4.5"
|
||||
|
@ -1148,6 +1575,39 @@ dependencies = [
|
|||
"winapi-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "schannel"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"core-foundation",
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
"security-framework-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "security-framework-sys"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b"
|
||||
dependencies = [
|
||||
"core-foundation-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "0.8.23"
|
||||
|
@ -1289,6 +1749,20 @@ dependencies = [
|
|||
"unicode-xid 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"libc",
|
||||
"rand 0.7.3",
|
||||
"redox_syscall",
|
||||
"remove_dir_all",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.1.0"
|
||||
|
@ -1425,12 +1899,22 @@ dependencies = [
|
|||
"percent-encoding 1.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.7.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a"
|
||||
dependencies = [
|
||||
"rand 0.6.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
|
||||
dependencies = [
|
||||
"rand 0.7.3",
|
||||
"serde 1.0.115",
|
||||
]
|
||||
|
||||
|
@ -1512,6 +1996,15 @@ version = "0.4.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "winutil"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7daf138b6b14196e3830a588acf1e86966c694d3e8fb026fb105b8b5dca07e6e"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
|
|
|
@ -16,11 +16,13 @@ env_logger = "0.7.1"
|
|||
rocket = "0.4.5"
|
||||
diesel = { version = "1.4.5", features = ["postgres", "uuidv07", "chrono"] } #uuidv07 vs uuid to use uuid >= 0.7
|
||||
diesel_geometry = "1.4.0"
|
||||
uuid = { version = "0.8", features = ["serde"] }
|
||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
rust-argon2 = "0.8.2"
|
||||
chrono = { version = "0.4.15", features = ["serde"] }
|
||||
rand = "0.7.3"
|
||||
iban_validate = "4"
|
||||
lettre = "0.9"
|
||||
lettre_email = "0.9"
|
||||
|
||||
[dependencies.rocket_contrib]
|
||||
version = "0.4.5"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
-- This file should undo anything in `up.sql`
|
||||
drop table password_resets;
|
|
@ -0,0 +1,17 @@
|
|||
-- Your SQL goes here
|
||||
create table password_resets
|
||||
(
|
||||
token text not null
|
||||
constraint password_resets_pk
|
||||
primary key,
|
||||
user_id uuid not null
|
||||
constraint password_resets_users_id_fk
|
||||
references users
|
||||
on update cascade on delete cascade,
|
||||
issued timestamp default CURRENT_TIMESTAMP not null
|
||||
);
|
||||
|
||||
create unique index password_resets_token_uindex
|
||||
on password_resets (token);
|
||||
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="jumbotron">
|
||||
<div class="row">
|
||||
<div class="col-lq">
|
||||
<h1>Welcome to ERMS!</h1>
|
||||
<h1>Willkommen bei einsatz.online!</h1>
|
||||
</div>
|
||||
{{#if logo_path}}
|
||||
<div class="col">
|
||||
|
@ -17,25 +17,26 @@
|
|||
{{#if alert}}
|
||||
{{> alert}}
|
||||
{{/if}}
|
||||
<h3>Login</h3>
|
||||
<h3>Anmelden</h3>
|
||||
<div class="form-group">
|
||||
<label for="login_email">Email address</label>
|
||||
<label for="login_email">E-Mail Adresse</label>
|
||||
<input type="email" class="form-control" name="login_email" id="login_email" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="login_password">Password</label>
|
||||
<label for="login_password">Passwort</label>
|
||||
<input type="password" class="form-control" name="login_password" id="login_password" required>
|
||||
</div>
|
||||
<button type="submit" class="login_submit btn btn-primary">Login</button>
|
||||
<button type="submit" class="login_submit btn btn-primary">Anmelden</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col">
|
||||
<form>
|
||||
<h3>Register</h3>
|
||||
<h3>Passwort vergessen?</h3>
|
||||
<div class="form-group">
|
||||
<label for="register_email">Email address</label>
|
||||
<input type="email" class="form-control" name="register_email" id="register_email" required>
|
||||
<label for="forgot_password_email">E-Mail Adresse</label>
|
||||
<input type="email" class="form-control" name="forgot_password_email" id="forgot_password_email" required>
|
||||
</div>
|
||||
<button type="submit" class="login_submit btn btn-secondary">Passwort zurücksetzen</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -16,4 +16,5 @@ pub mod users;
|
|||
pub mod units;
|
||||
pub mod units_members;
|
||||
pub mod create_member;
|
||||
pub mod login_protection;
|
||||
pub mod login_protection;
|
||||
pub mod password_resets;
|
|
@ -0,0 +1,28 @@
|
|||
use crate::helper::settings::Settings;
|
||||
use rocket::State;
|
||||
use crate::database::controller::connector::establish_connection;
|
||||
use crate::schema::password_resets::dsl::password_resets;
|
||||
use rand::{thread_rng, Rng};
|
||||
use rand::distributions::Alphanumeric;
|
||||
use diesel::{ExpressionMethods, RunQueryDsl};
|
||||
use chrono::NaiveDateTime;
|
||||
|
||||
/// Adds password reset token to database and returns it
|
||||
pub fn add_token(settings: &State<Settings>, user_id: uuid::Uuid) -> Result<String, diesel::result::Error>{
|
||||
let connection = establish_connection(settings);
|
||||
|
||||
let token : String = thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
.take(60)
|
||||
.collect();
|
||||
|
||||
|
||||
match diesel::insert_into(password_resets).values((crate::schema::password_resets::token.eq(token.clone()), crate::schema::password_resets::user_id.eq(user_id))).execute(&connection){
|
||||
Ok(_) => Ok(token),
|
||||
|
||||
Err(e) => {
|
||||
error!("Couldn't create password reset token: {}", e);
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
pub mod queue;
|
||||
pub mod worker;
|
|
@ -0,0 +1,123 @@
|
|||
use std::sync::RwLock;
|
||||
use std::collections::VecDeque;
|
||||
use chrono::NaiveDateTime;
|
||||
use std::io::{Error, Write, Read};
|
||||
use std::fs::File;
|
||||
use crate::helper::mail_queue::worker::send_mail;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
pub struct MailQueue{
|
||||
pub(crate) mails: RwLock<VecDeque<Mail>>
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize, Clone)]
|
||||
pub struct Mail{
|
||||
pub(crate) uuid: uuid::Uuid,
|
||||
pub(crate) from: String,
|
||||
pub(crate) to: Vec<String>,
|
||||
pub(crate) subject: String,
|
||||
pub(crate) cc: Vec<String>,
|
||||
pub(crate) bcc: Vec<String>,
|
||||
pub(crate) reply_to: Option<String>,
|
||||
pub(crate) body: String,
|
||||
pub(crate) deliver_until: Option<NaiveDateTime>
|
||||
}
|
||||
|
||||
impl MailQueue{
|
||||
pub fn add_mail(&self, mail: Mail) -> Result<(), std::sync::PoisonError<std::sync::RwLockWriteGuard<'_, std::collections::VecDeque<Mail>>>>{
|
||||
self.mails.write()?.push_back(mail);
|
||||
match self.save_to_disk(){
|
||||
Ok(_) => {}
|
||||
Err(e) => error!("Couldn't save mail_queue to disk: {}", e)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn get_next(&self) -> Result<Option<Mail>, std::sync::PoisonError<std::sync::RwLockWriteGuard<'_, std::collections::VecDeque<Mail>>>>{
|
||||
// TODO: Check if mail expired (deliver_until check)
|
||||
Ok(self.mails.write()?.pop_front())
|
||||
}
|
||||
pub fn process_next(&self) -> Result<(), std::sync::PoisonError<std::sync::RwLockWriteGuard<'_, std::collections::VecDeque<Mail>>>>{
|
||||
let mail = self.get_next()?;
|
||||
match mail{
|
||||
Some(mail) => {
|
||||
match send_mail(mail.clone()){
|
||||
Ok(_) => (),
|
||||
Err(_) => {
|
||||
return self.add_mail(mail)
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
},
|
||||
None => Ok(())
|
||||
}
|
||||
}
|
||||
pub fn load_or_create_new() -> MailQueue {
|
||||
match std::fs::File::open("mail_queue.txt"){
|
||||
Ok(mut file) => {
|
||||
let mut contents = String::new();
|
||||
match file.read_to_string(&mut contents){
|
||||
Ok(_) => {
|
||||
match serde_json::from_str::<MailQueue>(&contents){
|
||||
Ok(queue) => return queue,
|
||||
Err(e) => {
|
||||
panic!("Couldn't parse mail queue file: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
panic!("Couldn't read mail_queue.txt! {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
warn!("Couldn't read mail queue from disk. Creating new empty queue.");
|
||||
MailQueue{
|
||||
mails: RwLock::new(VecDeque::new())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fn save_to_disk(&self) -> std::io::Result<()> {
|
||||
let serialized = serde_json::to_string(&self)?;
|
||||
let mut file = std::fs::File::create("mail_queue.txt")?;
|
||||
file.write_all(serialized.as_bytes())
|
||||
}
|
||||
}
|
||||
|
||||
pub trait CreateMail<T>{
|
||||
fn new(args : T) -> Mail;
|
||||
}
|
||||
|
||||
impl CreateMail<(String, Vec<String>, String, Vec<String>, Vec<String>, Option<String>, String, Option<NaiveDateTime>)> for Mail{
|
||||
/// Create Mail with from, to, subject, cc, bcc, reply_to, deliver_until
|
||||
fn new(args: (String, Vec<String>, String, Vec<String>, Vec<String>, Option<String>, String, Option<NaiveDateTime>)) -> Mail {
|
||||
Mail{
|
||||
uuid: uuid::Uuid::new_v4(),
|
||||
from: args.0,
|
||||
to: args.1,
|
||||
subject: args.2,
|
||||
cc: args.3,
|
||||
bcc: args.4,
|
||||
reply_to: args.5,
|
||||
body: args.6,
|
||||
deliver_until: args.7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CreateMail<(String, Vec<String>, String, Option<String>, String)> for Mail{
|
||||
/// Create Mail with from, to, subject, reply_to
|
||||
fn new(args: (String, Vec<String>, String, Option<String>, String)) -> Mail {
|
||||
Mail{
|
||||
uuid: uuid::Uuid::new_v4(),
|
||||
from: args.0,
|
||||
to: args.1,
|
||||
subject: args.2,
|
||||
cc: vec![],
|
||||
bcc: vec![],
|
||||
reply_to: args.3,
|
||||
body: args.4,
|
||||
deliver_until: None
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
use crate::helper::mail_queue::queue::Mail;
|
||||
use lettre_email::EmailBuilder;
|
||||
use std::process::{Command, Output};
|
||||
use std::io::Error;
|
||||
|
||||
pub fn send_mail(mail: Mail) -> Result<(), ()> {
|
||||
if mail.to.is_empty() || mail.subject.is_empty() || mail.from.is_empty() || mail.body.is_empty() {
|
||||
error!("Couldn't deliver mail {} because to, subject, from or body missing! Deleting mail!", mail.uuid);
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
let mut arg = String::from("echo -e \"");
|
||||
arg.push_str(&mail.body);
|
||||
arg.push_str("\" | mailx --append='FROM: ");
|
||||
arg.push_str(&mail.from);
|
||||
arg.push_str("' ");
|
||||
if !mail.cc.is_empty(){
|
||||
arg.push_str("--append='CC:");
|
||||
for mail in mail.cc{
|
||||
arg.push_str(&(mail+","));
|
||||
}
|
||||
arg.push_str("' ")
|
||||
}
|
||||
if !mail.bcc.is_empty(){
|
||||
arg.push_str("--append='BCC:");
|
||||
for mail in mail.bcc{
|
||||
arg.push_str(&(mail+","));
|
||||
}
|
||||
arg.push_str("' ")
|
||||
}
|
||||
arg.push_str("-s \"");
|
||||
arg.push_str(&mail.subject);
|
||||
arg.push_str("\" ");
|
||||
for receiver in mail.to{
|
||||
arg.push_str(&(receiver+" "));
|
||||
}
|
||||
|
||||
match Command::new("sh").arg("-c").arg(arg).output(){
|
||||
Ok(output) => {
|
||||
if !output.status.success(){
|
||||
error!("Couldn't send mail: {} {} {}", output.status, String::from_utf8_lossy(&output.stderr), String::from_utf8_lossy(&output.stdout));
|
||||
Err(())
|
||||
}else {
|
||||
Ok(())
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
error!("Couldn't send mail: {}", e);
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,3 +11,4 @@ pub mod settings;
|
|||
pub mod sitebuilder;
|
||||
pub mod translate_diesel_error;
|
||||
pub mod user_request_guard;
|
||||
pub mod mail_queue;
|
16
src/main.rs
16
src/main.rs
|
@ -20,6 +20,11 @@ use crate::helper::session_cookies::model::SessionCookieStorage;
|
|||
use helper::settings::Settings;
|
||||
use rocket_contrib::serve::StaticFiles;
|
||||
use rocket_contrib::templates::Template;
|
||||
use std::{thread, time};
|
||||
use chrono::{DateTime, Utc};
|
||||
use crate::helper::mail_queue::queue::{MailQueue, Mail};
|
||||
use std::sync::{PoisonError, RwLockWriteGuard, Arc};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
pub mod database;
|
||||
pub mod helper;
|
||||
|
@ -45,9 +50,20 @@ fn main() {
|
|||
settings.application.default_language
|
||||
);
|
||||
|
||||
let mail_queue = Arc::new(MailQueue::load_or_create_new());
|
||||
let c_lock = Arc::clone(&mail_queue);
|
||||
|
||||
thread::spawn(move ||{
|
||||
loop {
|
||||
c_lock.process_next();
|
||||
thread::sleep(time::Duration::from_millis(500))
|
||||
}
|
||||
});
|
||||
|
||||
rocket::ignite()
|
||||
.manage(settings)
|
||||
.manage(cookie_storage)
|
||||
.manage(mail_queue)
|
||||
.register(catchers![helper::server_errors::unauthorized, helper::server_errors::forbidden, helper::server_errors::notfound, helper::server_errors::notimplemented])
|
||||
.mount(
|
||||
"/",
|
||||
|
|
|
@ -2,9 +2,13 @@ use crate::helper::sitebuilder::model::alerts::{Alert, AlertClass};
|
|||
use crate::modules::welcome::controller::render::get_context;
|
||||
use rocket::http::Status;
|
||||
use rocket_contrib::templates::Template;
|
||||
use crate::helper::mail_queue::queue::{MailQueue, Mail, CreateMail};
|
||||
use rocket::State;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[get("/?<error>")]
|
||||
pub fn welcome_get(error: Option<String>) -> Result<Template, Status> {
|
||||
pub fn welcome_get(error: Option<String>, mail_queue: State<Arc<MailQueue>>) -> Result<Template, Status> {
|
||||
mail_queue.add_mail(Mail::new(("test".to_string(), vec!["ares@anghenfil.de".to_string()], "Test.".to_string(), None, "Testnachricht".to_string())));
|
||||
let alert = match error {
|
||||
Some(error) => match error.as_str() {
|
||||
"unauthorized" => Some(Alert::new(
|
||||
|
|
|
@ -173,6 +173,17 @@ table! {
|
|||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
use diesel::sql_types::*;
|
||||
use diesel_geometry::sql_types::*;
|
||||
|
||||
password_resets (token) {
|
||||
token -> Text,
|
||||
user_id -> Uuid,
|
||||
valid_until -> Timestamp,
|
||||
}
|
||||
}
|
||||
|
||||
table! {
|
||||
use diesel::sql_types::*;
|
||||
use diesel_geometry::sql_types::*;
|
||||
|
@ -311,6 +322,7 @@ joinable!(members -> entities (entity_id));
|
|||
joinable!(members -> users (users_id));
|
||||
joinable!(members_roles -> entities (member_id));
|
||||
joinable!(members_roles -> roles (role_id));
|
||||
joinable!(password_resets -> users (user_id));
|
||||
joinable!(qualifications -> qualification_categories (category));
|
||||
joinable!(qualifications_members -> members (member_id));
|
||||
joinable!(qualifications_members -> qualifications (qualification_id));
|
||||
|
@ -340,6 +352,7 @@ allow_tables_to_appear_in_same_query!(
|
|||
login_attempts,
|
||||
members,
|
||||
members_roles,
|
||||
password_resets,
|
||||
permissions,
|
||||
qualification_categories,
|
||||
qualifications,
|
||||
|
|
Loading…
Reference in New Issue