# Resend Activation Email - 404 Error

**URL:** https://meta.discourse.org/t/resend-activation-email-404-error/279428
**Category:** Bug
**Created:** [September 18, 2023, 7:27pm UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428 "2023-09-18T19:27:50Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![john.sanchirico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/john.sanchirico/32/326470_2.png) [@john.sanchirico](https://meta.discourse.org/u/john.sanchirico)
#### Post date: [September 18, 2023, 7:27pm UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/1 "2023-09-18T19:27:51Z")

</div>

When a user signs up the activation email works fine. However attempting to Sign In and resend the activation emails results in the following production log:

```plaintext
Started POST "/u/action/send_activation_email" for (removed ip and timestamp)
Processing by UsersController#send_activation_email as */*
Completed 404 Not Found in 2ms (Views: 0.1ms | ActiveRecord: 0.0ms | Allocations: 542)

```

This error occurs on all of containers running 3.2.0.beta1-dev. “production\_errors.log” is empty.

Steps to reproduce:

1. Sign up with the default form
2. Ignore the activation email and attempt to sign in
3. Click “Resend Activation Email” on the popup “You can’t log in yet. We previously sent an activation email to you…”
4. “An error occurred: The requested URL or resource could not be found.”
5. Click “OK” and then the following popup appears “We sent another activation email to you at…” (However the second activation email is not actually sent)

I see the function/action `send_activation_email` is rate limited.

```plaintext
def send_activation_email
    if current_user.blank? || !current_user.staff?
      RateLimiter.new(nil, "activate-hr-#{request.remote_ip}", 30, 1.hour).performed!
      RateLimiter.new(nil, "activate-min-#{request.remote_ip}", 6, 1.minute).performed!
    end

```

**Would this result in the 404 error? Is there any other logs I can look at to debug this issue?**

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 19, 2023, 10:06pm UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/2 "2023-09-19T22:06:14Z")

</div>

Testing this on my local dev site, the problem seems to be that neither the `username` or `email` parameters get set for the `POST` request that’s made to `/u/action/send_activation_email` when the request is made after a user who has not clicked the link in the activation email attempts to login with a username/password:

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/a/e/7ae95026bedcfddb97c0121075a2cb16214a6389.png)

If, instead, the user clicks the Resend Activation Email button from the account-created page that’s displayed immediately after registering an account, the `username` parameter is set for the request. For reference, the button that is working is this one:

 ![image](https://global.discourse-cdn.com/meta/original/4X/3/c/e/3ce0fce23b7c03bb2c309fc99eebf91c8c7c0e69.png)

My guess about what’s happening is that for the request that _is_ working, is that the parameters for the `POST` request are being set based off the values the user enters when they complete the signup form.

The `404` error is being triggered here:

> <https://github.com/discourse/discourse/blob/main/app/controllers/users_controller.rb#L1175-L1177>

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [September 20, 2023, 12:29am UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/3 "2023-09-20T00:29:05Z")

</div>

> [@simon](#):
>
> the problem seems to be that neither the `username` or `email` parameters get set for the `POST` request that’s made to `/u/action/send_activation_email` when the request is made after a user who has not clicked the link in the activation email attempts to login with a username/password:

This sounds like a bug to me.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [September 28, 2023, 7:08pm UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/4 "2023-09-28T19:08:49Z")

</div>

Just adding a note that this issue also prevents users who have had their accounts deactivated from their admin / users page from triggering the activation email after they attempt to login and click the “Resend Activation Email” button.

That causes the same error as has been reported above.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [October 2, 2023, 11:39am UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/7 "2023-10-02T11:39:51Z")

</div>

Thanks for the report @john.sanchirico, and also @simon for the detailed analysis 🙏

This will be fixed by

[https://github.com/discourse/discourse/pull/23741](https://github.com/discourse/discourse/pull/23741)

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [October 4, 2023, 12:00am UTC](https://meta.discourse.org/t/resend-activation-email-404-error/279428/8 "2023-10-04T00:00:38Z")

</div>

This topic was automatically closed after 20 hours. New replies are no longer allowed.
