diff --git a/Cargo.lock b/Cargo.lock index dc107d2..d847a84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -248,7 +248,7 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "authifier" -version = "1.0.15" +version = "1.0.16" dependencies = [ "async-std", "async-trait", @@ -2403,7 +2403,7 @@ dependencies = [ [[package]] name = "rocket_authifier" -version = "1.0.15" +version = "1.0.16" dependencies = [ "async-std", "authifier", diff --git a/crates/authifier/Cargo.toml b/crates/authifier/Cargo.toml index 3eeb750..c84ab54 100644 --- a/crates/authifier/Cargo.toml +++ b/crates/authifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "authifier" -version = "1.0.15" +version = "1.0.16" edition = "2021" license = "Apache-2.0" authors = ["Pawel Makles "] diff --git a/crates/rocket_authifier/Cargo.toml b/crates/rocket_authifier/Cargo.toml index 6502033..092f003 100644 --- a/crates/rocket_authifier/Cargo.toml +++ b/crates/rocket_authifier/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rocket_authifier" -version = "1.0.15" +version = "1.0.16" edition = "2021" license = "Apache-2.0" authors = ["Pawel Makles "] diff --git a/crates/rocket_authifier/src/routes/account/send_password_reset.rs b/crates/rocket_authifier/src/routes/account/send_password_reset.rs index 5a53313..3d9edb0 100644 --- a/crates/rocket_authifier/src/routes/account/send_password_reset.rs +++ b/crates/rocket_authifier/src/routes/account/send_password_reset.rs @@ -1,5 +1,6 @@ //! Send a password reset email //! POST /account/reset_password +use authifier::models::EmailVerification; use authifier::util::normalise_email; use authifier::{Authifier, Result}; use rocket::serde::json::Json; @@ -47,7 +48,9 @@ pub async fn send_password_reset( .find_account_by_normalised_email(&email_normalised) .await? { - account.start_password_reset(authifier, false).await?; + if !matches!(account.verification, EmailVerification::Pending { .. }) { + account.start_password_reset(authifier, false).await?; + } } // Never fail this route, (except for db error) diff --git a/default.nix b/default.nix index 6592d9e..07d91ae 100644 --- a/default.nix +++ b/default.nix @@ -1,23 +1,26 @@ +{ pkgs ? import (fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/77ef7a29d276c6d8303aece3444d61118ef71ac2.tar.gz"; + sha256 = "0pm4l48jq8plzrrrisimahxqlcpx7qqq9c99hylmf7p3zlc3phsy"; + }) {}, +}: + let - # Pinned nixpkgs, deterministic. Last updated: 11-08-2023. - pkgs = import (fetchTarball("https://github.com/NixOS/nixpkgs/archive/bb9707ef2ea4a5b749b362d5cf81ada3ded2c53f.tar.gz")) {}; + nix-ld-libs = pkgs.buildEnv { + name = "nix-ld-libs"; + paths = with pkgs; [ + stdenv.cc.cc.lib + zlib + openssl + ]; + }; - # Rolling updates, not deterministic. - # pkgs = import (fetchTarball("channel:nixpkgs-unstable")) {}; in pkgs.mkShell { - name = "authifierEnv"; - - buildInputs = [ - # Tools - pkgs.git - - # Rust - pkgs.cargo - pkgs.rustc - pkgs.clippy - pkgs.pkgconfig - pkgs.openssl.dev + packages = with pkgs; [ + mise + pkg-config + openssl.dev + (writeShellScriptBin "fish" '' + exec ${pkgs.fish}/bin/fish -C 'mise activate fish | source' "$@" + '') ]; - - RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}"; -} +} \ No newline at end of file diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..acea3cf --- /dev/null +++ b/mise.toml @@ -0,0 +1,3 @@ +[tools] +gh = "2.25.0" +rust = "1.92.0"