Updated dependencies

This commit is contained in:
Keanu D?lle 2021-05-02 17:12:18 +02:00
parent ffcfa8e59c
commit ad32485445
5 changed files with 380 additions and 339 deletions

668
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -7,24 +7,24 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
config = "0.10.1"
serde_derive = "1.0.115"
serde = { version = "1.0.115", features = ["derive"] }
serde_json = "1.0.57"
log = "0.4.11"
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
config = "0.11.0"
serde_derive = "1.0.125"
serde = { version = "1.0.125", features = ["derive"] }
serde_json = "1.0.64"
log = "0.4.14"
env_logger = "0.8.3"
rocket = "0.4.7"
diesel = { version = "1.4.6", features = ["postgres", "uuidv07", "chrono"] } #uuidv07 vs uuid to use uuid >= 0.7
diesel_geometry = "1.4.0"
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"
uuid = { version = "0.8.2", features = ["serde", "v4"] }
rust-argon2 = "0.8.3"
chrono = { version = "0.4.19", features = ["serde"] }
rand = "0.8.3"
iban_validate = "4.0.0"
lettre = "0.9.5"
lettre_email = "0.9.4"
[dependencies.rocket_contrib]
version = "0.4.5"
version = "0.4.7"
default-features = false
features = ["handlebars_templates", "serve", "json"]

View File

@ -1 +1 @@
v0.1-28-g7fbdd7d
v0.1-32-gffcfa8e

View File

@ -10,14 +10,16 @@ use diesel::query_dsl::filter_dsl::FilterDsl;
use diesel::query_dsl::select_dsl::SelectDsl;
use argon2::Config;
use crate::schema::users::dsl::users;
use std::iter;
/// 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)
let mut rng = thread_rng();
let token: String = iter::repeat(())
.map(|()| rng.sample(Alphanumeric))
.map(char::from)
.take(60)
.collect();

View File

@ -8,7 +8,7 @@ use core::fmt;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use std::collections::HashMap;
use std::error;
use std::{error, iter};
use std::sync::RwLock;
impl SessionCookieStorage {
@ -17,7 +17,12 @@ impl SessionCookieStorage {
/// retrieve_id checks if generated id already exists in SessionCookieStorage.
/// If so, it will invoke itself again and generate new id.
fn retrieve_id(&self) -> String {
let id: String = thread_rng().sample_iter(&Alphanumeric).take(30).collect();
let mut rng = thread_rng();
let id: String = iter::repeat(())
.map(|()| rng.sample(Alphanumeric))
.map(char::from)
.take(30)
.collect();
if self.cookies.read().unwrap().contains_key(&id) {
self::SessionCookieStorage::retrieve_id(self)
} else {