From e1b26897be1027aee16b39fc312f48e1479e227e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 1 Mar 2024 11:22:53 -0500 Subject: [PATCH 1/4] Add nlnet grant line in readme. (#4484) --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 75f85f25d..524b7cf69 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,8 @@ Each Lemmy server can set its own moderation policy; appointing site-wide admins Lemmy is free, open-source software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. +Lemmy is made possible by a generous grant from the [NLnet foundation](https://nlnet.nl/). + - [Support on Liberapay](https://liberapay.com/Lemmy). - [Support on Patreon](https://www.patreon.com/dessalines). - [Support on OpenCollective](https://opencollective.com/lemmy). From c895e5708619fcebe2e75d905d258177ff08100b Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 1 Mar 2024 17:31:37 +0100 Subject: [PATCH 2/4] Remove unneeded error "last successful id is higher than latest id" (fixes #4363) (#4486) --- crates/federate/src/worker.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/crates/federate/src/worker.rs b/crates/federate/src/worker.rs index 0155ecd9b..eb209fd50 100644 --- a/crates/federate/src/worker.rs +++ b/crates/federate/src/worker.rs @@ -158,14 +158,6 @@ impl InstanceWorker { latest_id }; if id >= latest_id { - if id > latest_id { - tracing::error!( - "{}: last successful id {} is higher than latest id {} in database (did the db get cleared?)", - self.instance.domain, - id.0, - latest_id.0 - ); - } // no more work to be done, wait before rechecking tokio::select! { () = sleep(*WORK_FINISHED_RECHECK_DELAY) => {}, From a7fa075e8cbf6bda4d2706562c54995b39eae5b3 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 1 Mar 2024 17:32:13 +0100 Subject: [PATCH 3/4] Make logs less verbose (fixes #3627) (#4490) --- crates/utils/src/error.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/crates/utils/src/error.rs b/crates/utils/src/error.rs index 31f0707be..fddbc1e55 100644 --- a/crates/utils/src/error.rs +++ b/crates/utils/src/error.rs @@ -209,11 +209,7 @@ cfg_if! { impl fmt::Display for LemmyError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{}: ", &self.error_type)?; - // print anyhow including trace - // https://docs.rs/anyhow/latest/anyhow/struct.Error.html#display-representations - // this will print the anyhow trace (only if it exists) - // and if RUST_BACKTRACE=1, also a full backtrace - writeln!(f, "{:?}", self.inner)?; + writeln!(f, "{}", self.inner)?; fmt::Display::fmt(&self.context, f) } } From c5e54a318a92c39862192507cf6c8d8cbd9da424 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Fri, 1 Mar 2024 17:32:59 +0100 Subject: [PATCH 4/4] Store password reset token after email successfully sent (fixes #3757) (#4489) --- crates/api_common/src/utils.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index 25dc10344..d51751854 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -422,17 +422,19 @@ pub async fn send_password_reset_email( // Generate a random token let token = uuid::Uuid::new_v4().to_string(); - // Insert the row - let local_user_id = user.local_user.id; - PasswordResetRequest::create_token(pool, local_user_id, token.clone()).await?; - let email = &user.local_user.email.clone().expect("email"); let lang = get_interface_language(user); let subject = &lang.password_reset_subject(&user.person.name); let protocol_and_hostname = settings.get_protocol_and_hostname(); let reset_link = format!("{}/password_change/{}", protocol_and_hostname, &token); let body = &lang.password_reset_body(reset_link, &user.person.name); - send_email(subject, email, &user.person.name, body, settings).await + send_email(subject, email, &user.person.name, body, settings).await?; + + // Insert the row after successful send, to avoid using daily reset limit while + // email sending is broken. + let local_user_id = user.local_user.id; + PasswordResetRequest::create_token(pool, local_user_id, token.clone()).await?; + Ok(()) } /// Send a verification email