<p>I know why this happens - we have the same problem. It is related to the escaping of the <code>&amp;</code> in the password reset URL not being escaped: </p>

<pre><code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;id=1234
</code></pre>

<p>somehow, this arrives at our (and your I guess) server as: </p>

<pre><code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;amp;id=1234
</code></pre>

<p>Then the code is <code>abcd</code> and a parameter called <code>amp;id</code> is <code>1234</code>.</p>

<p>In our case, we have craft setup to send HTML emails, and have an email template like: </p>

<pre><code>Click here to reset your password: {{link}}
</code></pre>

<p>and end up with the link <code>http://yoursite/admin/actions/users/setpassword?code=abcd&amp;id=1234</code> directly in the HTML - this is <em>WRONG</em>, since the <code>&amp;</code> symbol has to be escaped as <code>&amp;amp;</code>. </p>

<p>Now, we could compensate, and make our template: </p>

<pre><code>Click here to reset: {{link|escape}}
</code></pre>

<p>Then we get correct HTML, but the plain-text version of the email is now broken. </p>

<p>AFAIK there is no way to have separate templates for text and html emails in craft? </p>

<p>I guess your problem is also HTML emails, OR you have a user with an overzealous email client, that adds the escape of the <code>&amp;</code> for you. </p>

CC BY-SA 3.0
2015-04-27T09:29:56.633Z
I'd like to know how to solve this, so I've asked it as a separate question:http://craftcms.stackexchange.com/questions/9467/how-to-encode-links-in-email-templates
gromgull
CC BY-SA 3.0
2017-09-18T08:29:27.367Z
So this seems to be an actual bug.
tom
CC BY-SA 3.0
2015-04-22T13:40:01.593Z
2015-07-03T18:14:03.707Z
2015-07-03T18:14:03.707Z
gromgull
<p>When hitting the "forgot password" link on the CP login form, an email is sent but the URL provided returns "Bad Request Param "id" doesn't exist." </p>

<p>Is this a bug or have I done something silly?</p>

<p>This is a site running on a local development environment with Craft 2.3.2636</p>

CC BY-SA 3.0
2015-03-04T19:45:37.037Z
Can you enable devMode, reproduce the issue, then immediately zip up your craft/storage/runtime/logs folder and send it to support@buildwithcraft.com?
Brad Bell
<users><control-panel><password>
Forgot password URL in email returns an error
# Forgot password URL in email returns an error

(Asked by: username_0 on 2015-03-04)

When hitting the "forgot password" link on the CP login form, an email is sent but the URL provided returns "Bad Request Param "id" doesn't exist."

Is this a bug or have I done something silly?

This is a site running on a local development environment with Craft 2.3.2636

**Tags:** users, control-panel, password
> **Comments:**
> **username_1**: Can you enable devMode, reproduce the issue, then immediately zip up your craft/storage/runtime/logs folder and send it to support@buildwithcraft.com?  

---

## 1 answers

### Answer by username_2 on 2015-04-22. Score: 3

I know why this happens - we have the same problem. It is related to the escaping of the & in the password reset URL not being escaped: 
http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234

somehow, this arrives at our (and your I guess) server as: 
http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234

Then the code is abcd and a parameter called amp;id is 1234.
In our case, we have craft setup to send HTML emails, and have an email template like: 
Click here to reset your password: {{link}}

and end up with the link http://yoursite/admin/actions/users/setpassword?code=abcd&id=1234 directly in the HTML - this is WRONG, since the & symbol has to be escaped as &. 
Now, we could compensate, and make our template: 
Click here to reset: {{link|escape}}

Then we get correct HTML, but the plain-text version of the email is now broken. 
AFAIK there is no way to have separate templates for text and html emails in craft? 
I guess your problem is also HTML emails, OR you have a user with an overzealous email client, that adds the escape of the & for you.

> **Comments:**
> **username_2**: I'd like to know how to solve this, so I've asked it as a separate question:http://craftcms.stackexchange.com/questions/9467/how-to-encode-links-in-email-templates  
> **username_3**: So this seems to be an actual bug.  

---

