AlchemyCMS / alchemy-devise

Devise based authorization for AlchemyCMS
https://alchemy-cms.com
BSD 3-Clause "New" or "Revised" License
15 stars 40 forks source link

ActiveModel::MassAssignmentSecurity::Error #4

Closed hopewise closed 10 years ago

hopewise commented 10 years ago

As I have upgraded my rails 3.2/ devise app to rails 4.03, I have installed alchemy-cms 3.0 & alchemy-devise, I get this error when try to sign in:

ActiveModel::MassAssignmentSecurity::Error in Devise::SessionsController#create Can't mass-assign protected attributes for Alchemy::User: password

Can you please tell me how to solve this problem?

Edit:

I think that the problem is that I am not extending User at your gem? Currently my User model extends ActiveRecord::Base like:

class User <  ActiveRecord::Base

So, what shall it be?

Edit:

My pre-existing project has already devise installed and working, I installed Alchemy-CMS, but my User is already set and has custom methods at my app, how can I integrate my app User into this gem User?

robinboening commented 10 years ago

If you already have devise working in your app and you want to use your existing User model to work with Alchemy, you don't need to require the alchemy-devise gem because it brings you a new user model with migrations.

To tell Alchemy to use your User model, you need to create an initializer as described here: https://github.com/magiclabs/alchemy_cms#authentication-user-model

If you notice any issues feel free to file a report here or ask in the google user group. You also should have a look into the User class of the alchemy-devise gem: https://github.com/magiclabs/alchemy-devise/blob/master/app/models/alchemy/user.rb

Thanks

tvdeyen commented 10 years ago

A good documentation on how to add your user model can be found here: https://github.com/magiclabs/alchemy_cms/blob/master/lib/alchemy/auth_accessors.rb#L1-L30

hopewise commented 10 years ago

Thanks very much, I will work on it and see ..

tvdeyen commented 10 years ago

I guess we can close this? Fell free to open another issue, if you still can't get it working.