Authentication failing on production server

102 views
Skip to first unread message

chris

unread,
Sep 24, 2010, 1:45:22 PM9/24/10
to Devise
On my development machine I can login fine, but once on production,
authentication fails for the base user created in the migration.

I can reset my password and upon doing so I am auto logged in, but
when I logout and try to login again using the newly entered password,
once again it tells my I have a bad email and/or password.

Any clues to why this would be?

nic...@w3bflows.com

unread,
Sep 26, 2010, 5:47:57 PM9/26/10
to Devise
+1

here is my user class

class User < ActiveRecord::Base
devise :database_authenticatable,
:recoverable, :rememberable, :trackable


# Setup accessible (or protected) attributes for your model

attr_accessible :email, :password, :password_confirmation, :remember_me
end

Carlos Antonio da Silva

unread,
Sep 26, 2010, 5:54:14 PM9/26/10
to plataforma...@googlegroups.com
Please, for such questions it's important that you post which devise version, your Model config, devise call in routes, and also if you have changed something inside the devise initializer, otherwise it's hard to think what might be going on.
--
At.
Carlos A. da Silva

chris

unread,
Sep 26, 2010, 6:17:39 PM9/26/10
to Devise
I am using everything as it is out of the box with the latest version
of 1.1.2.

# initializers/deploy.rb
no changes, although I have tried different encryption methods with no
luck

# Routes
devise_for :users

# User Model
class User < ActiveRecord::Base

devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation,
:remember_me, :first_name, :last_name,
:city, :postal_code, :province

def full_name
"#{first_name} #{last_name}"
end

end

# user migration
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable

# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation,
:remember_me, :first_name, :last_name,
:city, :postal_code, :province

def full_name
"#{first_name} #{last_name}"
end

end

# User migration
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable

# t.confirmable
# t.lockable :lock_strategy
=> :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable

# Custom
t.string :first_name
t.string :last_name
t.string :postal_code
t.string :address
t.string :city
t.string :province

t.timestamps
end

add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
end

def self.down
drop_table :users
end
end


# User admin flags
class AddUserAdminFlags < ActiveRecord::Migration
def self.up
add_column :users, :admin, :boolean, :default => false
add_column :users, :contributor, :boolean, :default => false

u = User.new()
u.email = "my_e...@gmail.com"
u.admin = true
u.password = "foobar"
u.password_confirmation = "foobar"
u.first_name = "John"
u.last_name = "Smith"
u.city = "Foobar"
u.postal_code = "123 456"
u.address = "123 45st"
u.save

end

def self.down
remove_column :users, :admin
remove_column :users, :contributor
end
end




On Sep 26, 3:54 pm, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> Please, for such questions it's important that you post which devise
> version, your Model config, devise call in routes, and also if you have
> changed something inside the devise initializer, otherwise it's hard to
> think what might be going on.
>
> On Sun, Sep 26, 2010 at 6:47 PM, nico...@w3bflows.com
> <nico...@w3bflows.com>wrote:

nic...@w3bflows.com

unread,
Sep 26, 2010, 6:22:27 PM9/26/10
to Devise
Tryed with rails 3 and devise 1.1.2, 1.1.3, and git master. None work

This issue seems be due to apache, when i launch a webrick server on
my production machine it works...

That said, i'm in the dark :/


On 26 sep, 23:54, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> Please, for such questions it's important that you post which devise
> version, your Model config, devise call in routes, and also if you have
> changed something inside the devise initializer, otherwise it's hard to
> think what might be going on.
>
> On Sun, Sep 26, 2010 at 6:47 PM, nico...@w3bflows.com
> <nico...@w3bflows.com>wrote:

Carlos Antonio da Silva

unread,
Sep 26, 2010, 6:36:34 PM9/26/10
to plataforma...@googlegroups.com
Have you guys enabled http auth in your production server? There is a know issue when both server and devise have http auth activated.
Please try disabling this option in devise (uncomment and set to false): http://github.com/plataformatec/devise/blob/v1.1/lib/generators/templates/devise.rb#L29

nic...@w3bflows.com

unread,
Sep 26, 2010, 7:00:32 PM9/26/10
to Devise
Works for me !! :-) How can i thank you guy ??!

On 27 sep, 00:36, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> Have you guys enabled http auth in your production server? There is a know
> issue when both server and devise have http auth activated.
> Please try disabling this option in devise (uncomment and set to false):http://github.com/plataformatec/devise/blob/v1.1/lib/generators/templ...
>
> On Sun, Sep 26, 2010 at 7:22 PM, nico...@w3bflows.com
> <nico...@w3bflows.com>wrote:

chris

unread,
Sep 26, 2010, 7:43:40 PM9/26/10
to Devise
:) That did it for me too.

Thanks so much Nicolas.

On Sep 26, 5:00 pm, "nico...@w3bflows.com" <nico...@w3bflows.com>
wrote:

Nicolas Papon

unread,
Sep 26, 2010, 8:05:22 PM9/26/10
to plataforma...@googlegroups.com
you're welcome, but the real guy to thank tonight is carlos ;-)

2010/9/27 chris <olsen...@gmail.com>

Carlos Antonio da Silva

unread,
Sep 26, 2010, 8:10:12 PM9/26/10
to plataforma...@googlegroups.com
Hey guys, really nice to know it's working fine now =).

@nicolas you owe me a beer ;)

chris

unread,
Sep 26, 2010, 9:27:04 PM9/26/10
to Devise
I apologize for the mix up, I looked up and read the wrong name.

Looks like I owe you two beers since my issue was on a production
server :)

Thanks again Carlos

On Sep 26, 6:10 pm, Carlos Antonio da Silva
<carlosantoniodasi...@gmail.com> wrote:
> Hey guys, really nice to know it's working fine now =).
>
> @nicolas you owe me a beer ;)
>
> On Sun, Sep 26, 2010 at 9:05 PM, Nicolas Papon
> <nicolas.pa...@w3bflows.com>wrote:
>
>
>
>
>
> > you're welcome, but the real guy to thank tonight is carlos ;-)
>
> > 2010/9/27 chris <olsen.ch...@gmail.com>
Reply all
Reply to author
Forward
0 new messages