double_auth_engine 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +8 -10
- data/README.md +11 -2
- data/app/views/user_sessions/new.html.erb +2 -2
- data/app/views/users/new.html.erb +2 -0
- data/double_auth_engine.gemspec +1 -0
- data/lib/double_auth_engine/controllers/user_sessions_controller_mixin.rb +1 -1
- data/lib/double_auth_engine/controllers/users_controller_mixin.rb +1 -1
- data/lib/double_auth_engine/generators/double_auth_engine/templates/user_migration.rb +1 -1
- data/lib/double_auth_engine/models/user_mixin.rb +1 -4
- data/lib/double_auth_engine/version.rb +1 -1
- data/lib/double_auth_engine.rb +1 -0
- data/spec/dummy/db/migrate/{20110408030355_create_users.rb → 20110503035658_create_users.rb} +1 -1
- data/spec/dummy/db/migrate/{20110408030356_create_roles.rb → 20110503035659_create_roles.rb} +0 -0
- data/spec/dummy/db/migrate/{20110408030357_create_assignments.rb → 20110503035660_create_assignments.rb} +0 -0
- data/spec/dummy/db/schema.rb +1 -1
- metadata +19 -8
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,16 +1,10 @@ | |
| 1 | 
            -
            GIT
         | 
| 2 | 
            -
              remote: git://github.com/jeremydurham/authlogic.git
         | 
| 3 | 
            -
              revision: 8fc34e1d58ea52e5439e7001eacb6d383f2bf0a0
         | 
| 4 | 
            -
              specs:
         | 
| 5 | 
            -
                authlogic (2.1.6)
         | 
| 6 | 
            -
                  activesupport
         | 
| 7 | 
            -
             | 
| 8 1 | 
             
            PATH
         | 
| 9 2 | 
             
              remote: .
         | 
| 10 3 | 
             
              specs:
         | 
| 11 | 
            -
                double_auth_engine (0.0. | 
| 12 | 
            -
                  authlogic
         | 
| 4 | 
            +
                double_auth_engine (0.0.3)
         | 
| 13 5 | 
             
                  declarative_authorization
         | 
| 6 | 
            +
                  friendly_id
         | 
| 7 | 
            +
                  kb-authlogic
         | 
| 14 8 |  | 
| 15 9 | 
             
            GEM
         | 
| 16 10 | 
             
              remote: http://rubygems.org/
         | 
| @@ -43,6 +37,7 @@ GEM | |
| 43 37 | 
             
                  activesupport (= 3.0.5)
         | 
| 44 38 | 
             
                activesupport (3.0.5)
         | 
| 45 39 | 
             
                arel (2.0.9)
         | 
| 40 | 
            +
                babosa (0.3.3)
         | 
| 46 41 | 
             
                builder (2.1.2)
         | 
| 47 42 | 
             
                capybara (0.4.1.2)
         | 
| 48 43 | 
             
                  celerity (>= 0.7.9)
         | 
| @@ -64,8 +59,12 @@ GEM | |
| 64 59 | 
             
                ffaker (1.5.0)
         | 
| 65 60 | 
             
                ffi (1.0.7)
         | 
| 66 61 | 
             
                  rake (>= 0.8.7)
         | 
| 62 | 
            +
                friendly_id (3.2.1.1)
         | 
| 63 | 
            +
                  babosa (~> 0.3.0)
         | 
| 67 64 | 
             
                i18n (0.5.0)
         | 
| 68 65 | 
             
                json_pure (1.5.1)
         | 
| 66 | 
            +
                kb-authlogic (2.1.7)
         | 
| 67 | 
            +
                  activesupport
         | 
| 69 68 | 
             
                mail (2.2.15)
         | 
| 70 69 | 
             
                  activesupport (>= 2.3.6)
         | 
| 71 70 | 
             
                  i18n (>= 0.4.0)
         | 
| @@ -126,7 +125,6 @@ PLATFORMS | |
| 126 125 | 
             
              ruby
         | 
| 127 126 |  | 
| 128 127 | 
             
            DEPENDENCIES
         | 
| 129 | 
            -
              authlogic (= 2.1.6)!
         | 
| 130 128 | 
             
              capybara (>= 0.4.0)
         | 
| 131 129 | 
             
              double_auth_engine!
         | 
| 132 130 | 
             
              ffaker
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # Double Auth Engine
         | 
| 2 2 | 
             
            [Authlogic](https://github.com/binarylogic/authlogic) and [Declarative Authorization](https://github.com/stffn/declarative_authorization) together in one fantastic Rails engine. Bladow!
         | 
| 3 3 |  | 
| 4 | 
            -
            ##  | 
| 4 | 
            +
            ## Setup
         | 
| 5 5 | 
             
            1. Add double_auth_engine to Gemfile
         | 
| 6 6 |  | 
| 7 7 | 
             
                    gem "double_auth_engine"
         | 
| @@ -31,6 +31,14 @@ | |
| 31 31 | 
             
            5. Start app
         | 
| 32 32 |  | 
| 33 33 | 
             
                    rails s
         | 
| 34 | 
            +
                    
         | 
| 35 | 
            +
            ## Usage
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            Anything within a Rails engine can be overridden by creating the same file within the parent application. For example if you'd like to create your own login form, simply create a `new.html.erb` within the `app/views/user_sessions` folder in your application. If you need to add additional functionality to one of the models or controllers provided by the engine, create the corresponding file in the appropriate place with your application and then include the associated module from the engine.
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                class User < ActiveRecord::Base
         | 
| 40 | 
            +
                  include DoubleAuthEngine::UserMixin
         | 
| 41 | 
            +
                end
         | 
| 34 42 |  | 
| 35 43 | 
             
            ## Readme Driven Development
         | 
| 36 44 |  | 
| @@ -44,11 +52,12 @@ A <del>strike</del> means its done! | |
| 44 52 | 
             
            * <del>Authlogic specs</del>
         | 
| 45 53 | 
             
            * <del>Add Declarative Authorization</del>
         | 
| 46 54 | 
             
            * <del>Declarative Authorization specs</del>
         | 
| 55 | 
            +
            * <del>Friendly ID</del>
         | 
| 47 56 | 
             
            * Mailer specs
         | 
| 48 57 | 
             
            * Style views
         | 
| 49 58 |  | 
| 50 59 | 
             
            ## Versioning
         | 
| 51 | 
            -
             | 
| 60 | 
            +
            This project uses [Semantic Versioning](http://semver.org/)
         | 
| 52 61 |  | 
| 53 62 | 
             
            ## Contributors
         | 
| 54 63 | 
             
            All contributions are welcome. Fork repo, make changes, add specs, ensure all specs pass, send a pull request.
         | 
| @@ -6,8 +6,8 @@ | |
| 6 6 | 
             
            </head>
         | 
| 7 7 | 
             
            <body>
         | 
| 8 8 | 
             
            <%= form_for @user_session do |f| %>
         | 
| 9 | 
            -
              <%= f.label : | 
| 10 | 
            -
              <%= f.text_field : | 
| 9 | 
            +
              <%= f.label :login, "Login or Email" %>
         | 
| 10 | 
            +
              <%= f.text_field :login %>
         | 
| 11 11 | 
             
              <%= f.label :password, "Password" %>
         | 
| 12 12 | 
             
              <%= f.password_field :password %>
         | 
| 13 13 | 
             
              <%= link_to 'Forgot Password?', forgot_password_path %>
         | 
    
        data/double_auth_engine.gemspec
    CHANGED
    
    
| @@ -2,7 +2,7 @@ class CreateUsers < ActiveRecord::Migration | |
| 2 2 | 
             
              def self.up
         | 
| 3 3 | 
             
                create_table :users do |t|
         | 
| 4 4 | 
             
                  t.string :email, :null => false
         | 
| 5 | 
            -
                  t.string :name, : | 
| 5 | 
            +
                  t.string :name, :null => false, :limit => 100
         | 
| 6 6 | 
             
                  t.string :location, :limit => 150
         | 
| 7 7 | 
             
                  t.string :crypted_password, :null => false
         | 
| 8 8 | 
             
                  t.string :password_salt, :null => false
         | 
| @@ -4,6 +4,7 @@ module DoubleAuthEngine | |
| 4 4 | 
             
                  base.class_eval do
         | 
| 5 5 | 
             
                    acts_as_authentic
         | 
| 6 6 | 
             
                    validates :email, :name, :presence => true
         | 
| 7 | 
            +
                    validates :name, :length => { :maximum => 100 }
         | 
| 7 8 | 
             
                    has_many :assignments
         | 
| 8 9 | 
             
                    has_many :roles, :through => :assignments
         | 
| 9 10 | 
             
                  end
         | 
| @@ -12,10 +13,6 @@ module DoubleAuthEngine | |
| 12 13 | 
             
                end
         | 
| 13 14 |  | 
| 14 15 | 
             
                module ClassMethods
         | 
| 15 | 
            -
                  def self.emails(query)
         | 
| 16 | 
            -
                    (User.all(:select => "DISTINCT(email)",
         | 
| 17 | 
            -
                              :conditions => ["email LIKE ?", "%#{query}%"])).map(& :email).compact
         | 
| 18 | 
            -
                  end
         | 
| 19 16 | 
             
                end
         | 
| 20 17 |  | 
| 21 18 | 
             
                module InstanceMethods
         | 
    
        data/lib/double_auth_engine.rb
    CHANGED
    
    | @@ -2,6 +2,7 @@ module DoubleAuthEngine | |
| 2 2 | 
             
              require "engine" if defined?(Rails) && Rails::VERSION::MAJOR == 3
         | 
| 3 3 | 
             
              require "authlogic"
         | 
| 4 4 | 
             
              require "declarative_authorization"
         | 
| 5 | 
            +
              require "friendly_id"
         | 
| 5 6 | 
             
              require File.join(File.dirname(__FILE__), "double_auth_engine", "models", "user_mixin")
         | 
| 6 7 | 
             
              require File.join(File.dirname(__FILE__), "double_auth_engine", "models", "user_session_mixin")
         | 
| 7 8 | 
             
              require File.join(File.dirname(__FILE__), "double_auth_engine", "models", "assignment_mixin")
         | 
    
        data/spec/dummy/db/migrate/{20110408030355_create_users.rb → 20110503035658_create_users.rb}
    RENAMED
    
    | @@ -2,7 +2,7 @@ class CreateUsers < ActiveRecord::Migration | |
| 2 2 | 
             
              def self.up
         | 
| 3 3 | 
             
                create_table :users do |t|
         | 
| 4 4 | 
             
                  t.string :email, :null => false
         | 
| 5 | 
            -
                  t.string :name, : | 
| 5 | 
            +
                  t.string :name, :null => false, :limit => 100
         | 
| 6 6 | 
             
                  t.string :location, :limit => 150
         | 
| 7 7 | 
             
                  t.string :crypted_password, :null => false
         | 
| 8 8 | 
             
                  t.string :password_salt, :null => false
         | 
    
        data/spec/dummy/db/migrate/{20110408030356_create_roles.rb → 20110503035659_create_roles.rb}
    RENAMED
    
    | 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/spec/dummy/db/schema.rb
    CHANGED
    
    | @@ -10,7 +10,7 @@ | |
| 10 10 | 
             
            #
         | 
| 11 11 | 
             
            # It's strongly recommended to check this file into your version control system.
         | 
| 12 12 |  | 
| 13 | 
            -
            ActiveRecord::Schema.define(:version =>  | 
| 13 | 
            +
            ActiveRecord::Schema.define(:version => 20110503035660) do
         | 
| 14 14 |  | 
| 15 15 | 
             
              create_table "assignments", :force => true do |t|
         | 
| 16 16 | 
             
                t.integer  "user_id"
         | 
    
        metadata
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 | 
             
            name: double_auth_engine
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 4 | 
             
              prerelease: 
         | 
| 5 | 
            -
              version: 0.0. | 
| 5 | 
            +
              version: 0.0.4
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors: 
         | 
| 8 8 | 
             
            - Kyle Bolton
         | 
| @@ -10,7 +10,7 @@ autorequire: | |
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 12 |  | 
| 13 | 
            -
            date: 2011- | 
| 13 | 
            +
            date: 2011-05-05 00:00:00 -04:00
         | 
| 14 14 | 
             
            default_executable: 
         | 
| 15 15 | 
             
            dependencies: 
         | 
| 16 16 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -35,6 +35,17 @@ dependencies: | |
| 35 35 | 
             
                    version: "0"
         | 
| 36 36 | 
             
              type: :runtime
         | 
| 37 37 | 
             
              version_requirements: *id002
         | 
| 38 | 
            +
            - !ruby/object:Gem::Dependency 
         | 
| 39 | 
            +
              name: friendly_id
         | 
| 40 | 
            +
              prerelease: false
         | 
| 41 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 42 | 
            +
                none: false
         | 
| 43 | 
            +
                requirements: 
         | 
| 44 | 
            +
                - - ">="
         | 
| 45 | 
            +
                  - !ruby/object:Gem::Version 
         | 
| 46 | 
            +
                    version: "0"
         | 
| 47 | 
            +
              type: :runtime
         | 
| 48 | 
            +
              version_requirements: *id003
         | 
| 38 49 | 
             
            description: Authlogic and Declarative Authorization Engine for Rails 3
         | 
| 39 50 | 
             
            email: kyle.bolton@gmail.com'
         | 
| 40 51 | 
             
            executables: []
         | 
| @@ -111,9 +122,9 @@ files: | |
| 111 122 | 
             
            - spec/dummy/config/initializers/setup_mail.rb
         | 
| 112 123 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 113 124 | 
             
            - spec/dummy/config/routes.rb
         | 
| 114 | 
            -
            - spec/dummy/db/migrate/ | 
| 115 | 
            -
            - spec/dummy/db/migrate/ | 
| 116 | 
            -
            - spec/dummy/db/migrate/ | 
| 125 | 
            +
            - spec/dummy/db/migrate/20110503035658_create_users.rb
         | 
| 126 | 
            +
            - spec/dummy/db/migrate/20110503035659_create_roles.rb
         | 
| 127 | 
            +
            - spec/dummy/db/migrate/20110503035660_create_assignments.rb
         | 
| 117 128 | 
             
            - spec/dummy/db/schema.rb
         | 
| 118 129 | 
             
            - spec/dummy/db/seeds.rb
         | 
| 119 130 | 
             
            - spec/dummy/lib/development_mail_interceptor.rb
         | 
| @@ -190,9 +201,9 @@ test_files: | |
| 190 201 | 
             
            - spec/dummy/config/initializers/setup_mail.rb
         | 
| 191 202 | 
             
            - spec/dummy/config/locales/en.yml
         | 
| 192 203 | 
             
            - spec/dummy/config/routes.rb
         | 
| 193 | 
            -
            - spec/dummy/db/migrate/ | 
| 194 | 
            -
            - spec/dummy/db/migrate/ | 
| 195 | 
            -
            - spec/dummy/db/migrate/ | 
| 204 | 
            +
            - spec/dummy/db/migrate/20110503035658_create_users.rb
         | 
| 205 | 
            +
            - spec/dummy/db/migrate/20110503035659_create_roles.rb
         | 
| 206 | 
            +
            - spec/dummy/db/migrate/20110503035660_create_assignments.rb
         | 
| 196 207 | 
             
            - spec/dummy/db/schema.rb
         | 
| 197 208 | 
             
            - spec/dummy/db/seeds.rb
         | 
| 198 209 | 
             
            - spec/dummy/lib/development_mail_interceptor.rb
         |