Sha256: 6f0609cef681a5978f9d953797a0d1d20b97316ff6074a1d89d3fd54de75efb1
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
module Cms module Authentication # For testing external authentication. class TestPasswordStrategy < Devise::Strategies::Authenticatable EXPECTED_LOGIN = EXPECTED_PASSWORD = 'test' def authenticate! if(authentication_hash[:login] == password && password == EXPECTED_PASSWORD) user = Cms::ExternalUser.authenticate(authentication_hash[:login], 'Test Password', {first_name: "Test", last_name: "User"}) user.authorize('cms-admin', 'content-editor') success!(user) else pass end end end end end Warden::Strategies.add(:test_password, Cms::Authentication::TestPasswordStrategy) # NOTE: To enable a custom password strategy for BrowserCMS you must also add it to to the devise configuration. # # For example enable the test_password strategy above by adding the following to config/initializers/devise.rb # # Add test_password strategy BEFORE other CMS authentication strategies # config.warden do |manager| # manager.default_strategies(:scope => :cms_user).unshift :test_password # end
Version data entries
3 entries across 3 versions & 2 rubygems