# Restful\_authentication issues in production

**URL:** <https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734>\
**Category:** Rails\
**Created:** [March 1, 2009, 10:02pm UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734 "2009-03-01T22:02:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaveeno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/58956e/32.png) [@gaveeno](https://www.ruby-forum.com/u/gaveeno)\
**Post date:** [March 1, 2009, 10:02pm UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734/1 "2009-03-01T22:02:13Z")

</div>

I’m not sure what’s going on here, but password resets with  
restful\_authentication aren’t working in production. However, they  
are working in development and staging.

The request to the passwords controller’s create action is completing  
successfully according to the server log:

Processing PasswordsController#create (for 68.107.52.195 at 2009-03-01  
14:36:29) [POST]  
Parameters: {“commit”=\>“Reset Password”,  
“authenticity\_token”=\>“a31cf1ba526601835092b65a6b471e9f134cee59”,  
“email”=\>“removed\_email\_address@domain.invalid”}  
Redirected to /login  
Completed in 592ms (DB: 149) | 302 Found [[http://www.mysite.com/](http://www.mysite.com/)  
password]

However, no password reset code is set in the DB and no email is  
delivered.

The only account on the production app is the administrator account  
because I haven’t yet opened it up for signups, and like an idiot I  
forgot my password so I’m not even sure if logging in works in  
production.

What gives?

---

<div class="post-metadata">

**Author:** ![gaveeno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/58956e/32.png) [@gaveeno](https://www.ruby-forum.com/u/gaveeno)\
**Post date:** [March 1, 2009, 10:15pm UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734/2 "2009-03-01T22:15:47Z")

</div>

I just manually set the password reset code in the DB. I then tried  
to reset the password and it didn’t work. What’s going on?

---

<div class="post-metadata">

**Author:** ![gaveeno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/58956e/32.png) [@gaveeno](https://www.ruby-forum.com/u/gaveeno)\
**Post date:** [March 2, 2009, 12:27pm UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734/3 "2009-03-02T12:27:29Z")

</div>

gaveeno wrote:

> I just manually set the password reset code in the DB. I then tried  
> to reset the password and it didn’t work. What’s going on?

Did you check if “password\_reset\_code” field present in the DB?

---

<div class="post-metadata">

**Author:** ![gaveeno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/58956e/32.png) [@gaveeno](https://www.ruby-forum.com/u/gaveeno)\
**Post date:** [March 19, 2009, 3:26pm UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734/4 "2009-03-19T15:26:25Z")

</div>

Did you have any luck solving this? I’m having the exact same problem  
and can’t figure how to fix it.

---

<div class="post-metadata">

**Author:** ![gaveeno](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/58956e/32.png) [@gaveeno](https://www.ruby-forum.com/u/gaveeno)\
**Post date:** [March 20, 2009, 1:25am UTC](https://www.ruby-forum.com/t/restful-authentication-issues-in-production/161734/5 "2009-03-20T01:25:39Z")

</div>

silly me.  
In my passwords controller:

def create  
return unless request.post?  
if @user = User.find\_by\_email(params[:email])  
@user.forgot\_password  
@user.save  
…  
end

All I did was add “!” to @user.save, and now it works.
