Okay, I pasted that code to devise.rb (after the end of the Devise.setup do
|config| block).
I got the Devise sign_in page to display. When I submit it, I get the following
error - again, related to password_salt:
NoMethodError in Devise/sessionsController#create
undefined method `password_salt' for #<User:0x000001023b6db8>
Rails.root: /Users/mark/Sites/rails/cms-dm
Application Trace | Framework Trace | Full Trace
devise (1.1.3) lib/devise/models/database_authenticatable.rb:85:in
`password_digest'
devise (1.1.3) lib/devise/models/database_authenticatable.rb:47:in
`valid_password?'
devise (1.1.3) lib/devise/strategies/database_authenticatable.rb:10:in `block
in authenticate!'
devise (1.1.3) lib/devise/models/authenticatable.rb:55:in
`valid_for_authentication?'
devise (1.1.3) lib/devise/strategies/authenticatable.rb:19:in `validate'
devise (1.1.3) lib/devise/strategies/database_authenticatable.rb:10:in
`authenticate!'
warden (0.10.7) lib/warden/strategies/base.rb:53:in `_run!'
warden (0.10.7) lib/warden/proxy.rb:286:in `block in _run_strategies_for'
warden (0.10.7) lib/warden/proxy.rb:281:in `each'
warden (0.10.7) lib/warden/proxy.rb:281:in `_run_strategies_for'
warden (0.10.7) lib/warden/proxy.rb:258:in `_perform_authentication'
warden (0.10.7) lib/warden/proxy.rb:105:in `authenticate!'
devise (1.1.3) app/controllers/devise/sessions_controller.rb:13:in `create'
actionpack (3.0.1) lib/action_controller/metal/implicit_render.rb:4:in
`send_action'
actionpack (3.0.1) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.1) lib/action_controller/metal/rendering.rb:11:in
`process_action'
actionpack (3.0.1) lib/abstract_controller/callbacks.rb:18:in `block in
process_action'
activesupport (3.0.1) lib/active_support/callbacks.rb:450:in
`_run__1439887843518537227__process_action__4376594802776458460__callbacks'
activesupport (3.0.1) lib/active_support/callbacks.rb:409:in
`_run_process_action_callbacks'
activesupport (3.0.1) lib/active_support/callbacks.rb:93:in `run_callbacks'
actionpack (3.0.1) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:30:in `block
in process_action'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
instrument'
activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
`instrument'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:29:in
`process_action'
actionpack (3.0.1) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.1) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.1) lib/abstract_controller/rendering.rb:40:in `process'
actionpack (3.0.1) lib/action_controller/metal.rb:133:in `dispatch'
actionpack (3.0.1) lib/action_controller/metal/rack_delegation.rb:14:in
`dispatch'
actionpack (3.0.1) lib/action_controller/metal.rb:173:in `block in action'
dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:12:in `call'
dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:12:in `block in call'
dm-core (1.0.2) lib/dm-core.rb:299:in `block in repository'
dm-core (1.0.2) lib/dm-core/repository.rb:114:in `scope'
dm-core (1.0.2) lib/dm-core.rb:299:in `repository'
dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:11:in `call'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:27:in `call'
actionpack (3.0.1) lib/action_dispatch/routing/mapper.rb:34:in `call'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:75:in `optimized_each'
rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:492:in `call'
/Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib/rails_metrics/middleware.rb:15:in
`block (2 levels) in call'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
instrument'
activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
`instrument'
activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
/Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib/rails_metrics/middleware.rb:12:in
`block in call'
/Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib/rails_metrics.rb:48:in
`listen_request'
/Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib/rails_metrics/middleware.rb:11:in
`call'
warden (0.10.7) lib/warden/manager.rb:35:in `block in call'
warden (0.10.7) lib/warden/manager.rb:34:in `catch'
warden (0.10.7) lib/warden/manager.rb:34:in `call'
actionpack (3.0.1)
lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.1)
lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/cookies.rb:287:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:46:in `block in
call'
activesupport (3.0.1) lib/active_support/callbacks.rb:415:in
`_run_call_callbacks'
actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/show_exceptions.rb:46:in
`call'
railties (3.0.1) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.1) lib/active_support/cache/strategy/local_cache.rb:72:in
`call'
rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.1) lib/rack/lock.rb:11:in `call'
actionpack (3.0.1) lib/action_dispatch/middleware/static.rb:30:in `call'
railties (3.0.1) lib/rails/application.rb:168:in `call'
railties (3.0.1) lib/rails/application.rb:77:in `method_missing'
railties (3.0.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.1) lib/rack/content_length.rb:13:in `call'
rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
/Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:111:in
`service'
/Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb:70:in
`run'
/Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/server.rb:183:in
`block in start_thread'
Request
Parameters:
{"utf8"=>"✓",
"authenticity_token"=>"XPemRlrnqotcWkYJ8bSJA+r3RjlY9UK0ceLuWfHKn0Q=",
"user"=>{"username"=>"mrichman",
"password"=>"[FILTERED]",
"remember_me"=>"0"},
"commit"=>"Sign in"}
--
Mark A. Richman, MBA
http://www.markrichman.com
tel: (954) 234-9049
skype: mark_richman
On Nov 18, 2010, at 11:04 AM, Jared Morgan wrote:
> I think I understand now. There's some code in dm-devise that defines the
> expected properties if they're not already defined. Since you won't have a
> password_salt property or db field that's causing the problem. I'll look
> into adding a way to disable that for legacy DBs in the next few days. In
> the meantime, you could try adding the following to the bottom of
> config/initializers/devise.rb:
>
> module Devise
> module Orm
> module DataMapper
> module Hook
> def devise_modules_hook!
> include Compatibility
> yield
> devise_modules.each { |m| send(m) if respond_to?(m, true) }
> end
> end
> end
> end
> end
>
> That should remove the attempt to apply devise's schema.
>
> Also, if you haven't already, check out
> https://github.com/plataformatec/devise/wiki/How-To:-Allow-users-to-sign-in-
> with-something-other-than-their-email-address for info on logging in with a
> field other than email.
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On
> Behalf Of Mark Richman
> Sent: Thursday, November 18, 2010 9:39 AM
> To: [email protected]
> Subject: Re: [DataMapper] Re: Authentication
>
> I renamed the property in my User model (still no dice):
>
> property :encrypted_password, String, :field => 'PasswordSHA1Hash',
> :required => true
>
>
> I'm using rvm, ruby 1.9.2, rails 3.0.1, and here's my Gemfile:
>
> source 'http://rubygems.org'
> source 'https://github.com/'
>
> RAILS_VERSION = '~> 3.0.1'
> DM_VERSION = '~> 1.0.2'
>
> gem 'activesupport', RAILS_VERSION, :require => 'active_support'
> gem 'actionpack', RAILS_VERSION, :require => 'action_pack'
> gem 'actionmailer', RAILS_VERSION, :require => 'action_mailer'
> gem 'railties', RAILS_VERSION, :require => 'rails'
>
> gem 'dm-core', DM_VERSION
> gem 'dm-rails', '~> 1.0.4'
> gem 'dm-mysql-adapter', DM_VERSION
> gem 'dm-migrations', DM_VERSION
> gem 'dm-types', DM_VERSION
> gem 'dm-validations', DM_VERSION
> gem 'dm-constraints', DM_VERSION
> gem 'dm-transactions', DM_VERSION
> gem 'dm-aggregates', DM_VERSION
> gem 'dm-timestamps', DM_VERSION
> gem 'dm-observer', DM_VERSION
> gem 'dm-pager', DM_VERSION
> gem 'dm-serializer', DM_VERSION
> gem 'dm-devise', '~> 1.1.4'
>
> gem 'tiny_mce'
>
> group(:development, :test) do
> gem 'rspec-rails', '~> 2.0.1'
> gem 'rails_metrics', '~> 0.1', :git =>
> 'git://github.com/engineyard/rails_metrics'
> end
>
>
> Here's my stack trace:
>
> DataObjects::SQLError in Users#index
>
> Showing /Users/mark/Sites/rails/cms-dm/app/views/users/index.html.erb where
> line #14 raised:
>
> Unknown column 'password_salt' in 'field list'
> Extracted source (around line #14):
>
> 11: <th></th>
> 12: </tr>
> 13:
> 14: <% @users.each do |user| %>
> 15: <tr>
> 16: <td><%= user.first_name %></td>
> 17: <td><%= user.last_name %></td>
>
> Rails.root: /Users/mark/Sites/rails/cms-dm
>
> Application Trace | Framework Trace | Full Trace
> dm-do-adapter (1.0.2) lib/dm-do-adapter/adapter.rb:142:in `execute_reader'
> dm-do-adapter (1.0.2) lib/dm-do-adapter/adapter.rb:142:in `block in read'
> dm-do-adapter (1.0.2) lib/dm-do-adapter/adapter.rb:260:in `with_connection'
> dm-do-adapter (1.0.2) lib/dm-do-adapter/adapter.rb:138:in `read'
> dm-core (1.0.2) lib/dm-core/repository.rb:162:in `read'
> dm-core (1.0.2) lib/dm-core/collection.rb:1116:in `lazy_load'
> dm-core (1.0.2) lib/dm-core/support/lazy_array.rb:411:in `each'
> dm-core (1.0.2) lib/dm-core/collection.rb:508:in `each'
> app/views/users/index.html.erb:14:in
> `_app_views_users_index_html_erb___3029617070929662103_2167103340__404884944
> 5790697924'
> actionpack (3.0.1) lib/action_view/template.rb:135:in `block in render'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
> instrument'
> activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
> `instrument'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
> actionpack (3.0.1) lib/action_view/template.rb:127:in `render'
> actionpack (3.0.1) lib/action_view/render/rendering.rb:59:in `block in
> _render_template'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
> instrument'
> activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
> `instrument'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
> actionpack (3.0.1) lib/action_view/render/rendering.rb:56:in
> `_render_template'
> actionpack (3.0.1) lib/action_view/render/rendering.rb:26:in `render'
> actionpack (3.0.1) lib/abstract_controller/rendering.rb:114:in
> `_render_template'
> actionpack (3.0.1) lib/abstract_controller/rendering.rb:108:in
> `render_to_body'
> actionpack (3.0.1) lib/action_controller/metal/renderers.rb:47:in
> `render_to_body'
> actionpack (3.0.1) lib/action_controller/metal/compatibility.rb:55:in
> `render_to_body'
> actionpack (3.0.1) lib/abstract_controller/rendering.rb:101:in
> `render_to_string'
> actionpack (3.0.1) lib/abstract_controller/rendering.rb:92:in `render'
> actionpack (3.0.1) lib/action_controller/metal/rendering.rb:17:in `render'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:40:in
> `block (2 levels) in render'
> activesupport (3.0.1) lib/active_support/core_ext/benchmark.rb:5:in `block
> in ms'
> /Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/benchmark.rb:309:in
> `realtime'
> activesupport (3.0.1) lib/active_support/core_ext/benchmark.rb:5:in `ms'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:40:in
> `block in render'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:78:in
> `cleanup_view_runtime'
> dm-rails (1.0.4) lib/dm-rails/railties/controller_runtime.rb:19:in
> `cleanup_view_runtime'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:39:in
> `render'
> actionpack (3.0.1) lib/action_controller/metal/implicit_render.rb:10:in
> `default_render'
> actionpack (3.0.1) lib/action_controller/metal/mime_responds.rb:261:in
> `block in retrieve_response_from_mimes'
> actionpack (3.0.1) lib/action_controller/metal/mime_responds.rb:192:in
> `call'
> actionpack (3.0.1) lib/action_controller/metal/mime_responds.rb:192:in
> `respond_to'
> app/controllers/users_controller.rb:8:in `index'
> actionpack (3.0.1) lib/action_controller/metal/implicit_render.rb:4:in
> `send_action'
> actionpack (3.0.1) lib/abstract_controller/base.rb:150:in `process_action'
> actionpack (3.0.1) lib/action_controller/metal/rendering.rb:11:in
> `process_action'
> actionpack (3.0.1) lib/abstract_controller/callbacks.rb:18:in `block in
> process_action'
> activesupport (3.0.1) lib/active_support/callbacks.rb:440:in
> `_run__1342084376262806658__process_action__359523683463716088__callbacks'
> activesupport (3.0.1) lib/active_support/callbacks.rb:409:in
> `_run_process_action_callbacks'
> activesupport (3.0.1) lib/active_support/callbacks.rb:93:in `run_callbacks'
> actionpack (3.0.1) lib/abstract_controller/callbacks.rb:17:in
> `process_action'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:30:in
> `block in process_action'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
> instrument'
> activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
> `instrument'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
> actionpack (3.0.1) lib/action_controller/metal/instrumentation.rb:29:in
> `process_action'
> actionpack (3.0.1) lib/action_controller/metal/rescue.rb:17:in
> `process_action'
> actionpack (3.0.1) lib/abstract_controller/base.rb:119:in `process'
> actionpack (3.0.1) lib/abstract_controller/rendering.rb:40:in `process'
> actionpack (3.0.1) lib/action_controller/metal.rb:133:in `dispatch'
> actionpack (3.0.1) lib/action_controller/metal/rack_delegation.rb:14:in
> `dispatch'
> actionpack (3.0.1) lib/action_controller/metal.rb:173:in `block in action'
> dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:12:in `call'
> dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:12:in `block in
> call'
> dm-core (1.0.2) lib/dm-core.rb:299:in `block in repository'
> dm-core (1.0.2) lib/dm-core/repository.rb:114:in `scope'
> dm-core (1.0.2) lib/dm-core.rb:299:in `repository'
> dm-rails (1.0.4) lib/dm-rails/middleware/identity_map.rb:11:in `call'
> actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:62:in `dispatch'
> actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:27:in `call'
> rack-mount (0.6.13) lib/rack/mount/route_set.rb:148:in `block in call'
> rack-mount (0.6.13) lib/rack/mount/code_generation.rb:93:in `block in
> recognize'
> rack-mount (0.6.13) lib/rack/mount/code_generation.rb:68:in `optimized_each'
> rack-mount (0.6.13) lib/rack/mount/code_generation.rb:92:in `recognize'
> rack-mount (0.6.13) lib/rack/mount/route_set.rb:139:in `call'
> actionpack (3.0.1) lib/action_dispatch/routing/route_set.rb:492:in `call'
> /Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib
> /rails_metrics/middleware.rb:15:in `block (2 levels) in call'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `block in
> instrument'
> activesupport (3.0.1) lib/active_support/notifications/instrumenter.rb:21:in
> `instrument'
> activesupport (3.0.1) lib/active_support/notifications.rb:52:in `instrument'
> /Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib
> /rails_metrics/middleware.rb:12:in `block in call'
> /Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib
> /rails_metrics.rb:48:in `listen_request'
> /Users/mark/.rvm/gems/ruby-1.9.2-head/bundler/gems/rails_metrics-8a3ccda/lib
> /rails_metrics/middleware.rb:11:in `call'
> warden (0.10.7) lib/warden/manager.rb:35:in `block in call'
> warden (0.10.7) lib/warden/manager.rb:34:in `catch'
> warden (0.10.7) lib/warden/manager.rb:34:in `call'
> actionpack (3.0.1)
> lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/head.rb:14:in `call'
> rack (1.2.1) lib/rack/methodoverride.rb:24:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/params_parser.rb:21:in
> `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/flash.rb:182:in `call'
> actionpack (3.0.1)
> lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/cookies.rb:287:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:46:in `block
> in call'
> activesupport (3.0.1) lib/active_support/callbacks.rb:415:in
> `_run_call_callbacks'
> actionpack (3.0.1) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
> rack (1.2.1) lib/rack/sendfile.rb:107:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/show_exceptions.rb:46:in
> `call'
> railties (3.0.1) lib/rails/rack/logger.rb:13:in `call'
> rack (1.2.1) lib/rack/runtime.rb:17:in `call'
> activesupport (3.0.1) lib/active_support/cache/strategy/local_cache.rb:72:in
> `call'
> rack (1.2.1) lib/rack/lock.rb:11:in `block in call'
> <internal:prelude>:10:in `synchronize'
> rack (1.2.1) lib/rack/lock.rb:11:in `call'
> actionpack (3.0.1) lib/action_dispatch/middleware/static.rb:30:in `call'
> railties (3.0.1) lib/rails/application.rb:168:in `call'
> railties (3.0.1) lib/rails/application.rb:77:in `method_missing'
> railties (3.0.1) lib/rails/rack/log_tailer.rb:14:in `call'
> rack (1.2.1) lib/rack/content_length.rb:13:in `call'
> rack (1.2.1) lib/rack/handler/webrick.rb:52:in `service'
> /Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb
> :111:in `service'
> /Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/httpserver.rb
> :70:in `run'
> /Users/mark/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/webrick/server.rb:183
> :in `block in start_thread'
>
> Thanks again,
> Mark
>
> --
> Mark A. Richman, MBA
> http://www.markrichman.com
> tel: (954) 234-9049
> skype: mark_richman
>
> On Nov 18, 2010, at 10:26 AM, Jared Morgan wrote:
>
>> Mark,
>> Could you send me a stack trace for the error and DM gem versions. It's
> not
>> the error I would have expected. As far as devise is concerned, you just
>> need an encrypted_password method in your model, so something like:
>>
>> def encrypted_password
>> attribute_get(:password_hash)
>> end
>>
>> (or, if you can, rename the :password_hash property to
> :encrypted_password).
>>
>> - Jared
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On
>> Behalf Of Mark Richman
>> Sent: Thursday, November 18, 2010 8:52 AM
>> To: DataMapper
>> Subject: [DataMapper] Re: Authentication
>>
>> Thanks Jared. I was able to implement a custom encryptor per those
>> instructions:
>>
>> module Devise
>> module Encryptors
>> class Sha1Base64 < Base
>> def self.digest(password, stretches, salt, pepper)
>> sha1 = Digest::SHA1.digest(password)
>> Base64.strict_encode64(sha1)
>> end
>> end
>> end
>> end
>>
>> Yes, I realize there is no salt, etc. That's a legacy db for ya :-)
>>
>> My next hurdle is this error: "Unknown column 'encrypted_password' in
>> 'field list'". This is likely because my legacy database has no such
>> field. My user model is as follows:
>>
>> class User
>> include DataMapper::Resource
>> include DataMapper::MassAssignmentSecurity
>>
>> # Include default devise modules. Others available are:
>> # :token_authenticatable, :confirmable, :lockable and :timeoutable
>> devise :database_authenticatable, :registerable,
>> :recoverable, :rememberable, :trackable, :validatable
>>
>> storage_names[:default] = 'kms_User'
>> property :id, Serial, :field =>
>> 'UserId', :required => true
>> property :username, String, :field =>
>> 'LoginId', :required => true
>> property :password_hash, String, :field =>
>> 'PasswordSHA1Hash', :required => true
>> property :enabled, Integer, :field =>
>> 'Enabled', :required => true
>> property :is_admin, Integer, :field =>
>> 'IsSuperAdmin', :required => true
>> property :first_name, String, :field =>
>> 'Name', :required => true
>> property :last_name, String, :field =>
>> 'Surname', :required => true
>> property :born_on, DateTime, :field => 'Birthday'
>> property :email, String, :field =>
>> 'Email', :required => true
>> property :site_url, String, :field =>
>> 'SiteUrl', :required => true
>> property :blog_url, String, :field =>
>> 'BlogUrl', :required => true
>> property :im_contact, String, :field =>
>> 'IMContact', :required => true
>> property :skype_name, String, :field =>
>> 'SkypeContact', :required => true
>> property :photo_id, Integer, :field => 'PhotoId'
>>
>>
>> attr_accessible :id, :username, :first_name, :last_name, :email, :born_on
>>
>> end
>>
>> I guess I need to do some custom logic for :password_hash? I realize
>> this is not a Devise support forum, but if you have any suggestions as
>> to what to do next, I'd appreciate it.
>>
>> Thanks,
>> Mark
>>
>> On Nov 17, 9:20 pm, "Jared Morgan" <[email protected]> wrote:
>>> dm-devise [https://github.com/jm81/dm-devise] might work for you. I'm
>> using
>>> it in a similar situation--Rails 3, DataMapper and custom hashing. The
>>> dm-devise gem just adds DataMapper support to devise
>>> [https://github.com/plataformatec/devise]. There's an article on the
>> devise
>>> wiki about using a custom hashing algorithm
>> athttps://github.com/plataformatec/devise/wiki/How-To:-Create-a-custom-...
>>> or.
>>>
>>> - Jared Morgan
>>>
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]] On
>>>
>>> Behalf Of Mark Richman
>>> Sent: Wednesday, November 17, 2010 7:38 PM
>>> To: DataMapper
>>> Subject: [DataMapper] Authentication
>>>
>>> Can someone recommend an authentication solution that works with
>>> DataMapper and Rails 3? I have used Authlogic in the past, but it
>>> appears to be intimately tied to ActiveRecord. I'll also require
>>> control over the password hashing algorithm used, since I have a
>>> custom one I'll need to use with my legacy database (where my user
>>> table lives).
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "DataMapper" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group
>> athttp://groups.google.com/group/datamapper?hl=en.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "DataMapper" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/datamapper?hl=en.
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
> [email protected].
>> For more options, visit this group at
> http://groups.google.com/group/datamapper?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/datamapper?hl=en.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/datamapper?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/datamapper?hl=en.