devise_token_auth 0.1.30 → 0.1.31.beta1
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.
- checksums.yaml +4 -4
- data/README.md +51 -8
- data/app/controllers/devise_token_auth/registrations_controller.rb +2 -2
- data/app/models/devise_token_auth/concerns/user.rb +8 -4
- data/lib/devise_token_auth/version.rb +1 -1
- data/lib/generators/devise_token_auth/install_generator.rb +4 -0
- data/lib/generators/devise_token_auth/templates/user.rb +4 -0
- data/test/controllers/devise_token_auth/omniauth_callbacks_controller_test.rb +10 -0
- data/test/controllers/devise_token_auth/registrations_controller_test.rb +45 -0
- data/test/controllers/devise_token_auth/sessions_controller_test.rb +28 -0
- data/test/dummy/app/models/only_email_user.rb +5 -0
- data/test/dummy/app/models/unregisterable_user.rb +7 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20141222035835_devise_token_auth_create_only_email_users.rb +54 -0
- data/test/dummy/db/migrate/20141222053502_devise_token_auth_create_unregisterable_users.rb +54 -0
- data/test/dummy/db/schema.rb +46 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +602 -0
- data/test/dummy/log/test.log +47403 -0
- data/test/dummy/tmp/generators/app/models/mang.rb +7 -0
- data/test/dummy/tmp/generators/app/models/user.rb +7 -0
- data/test/dummy/tmp/generators/config/initializers/devise_token_auth.rb +22 -0
- data/test/dummy/tmp/generators/config/routes.rb +9 -0
- data/test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_mangs.rb +54 -0
- data/test/dummy/tmp/generators/db/migrate/20141222060432_devise_token_auth_create_users.rb +54 -0
- data/test/fixtures/only_email_users.yml +9 -0
- data/test/models/only_email_user_test.rb +35 -0
- metadata +28 -8
- data/test/dummy/tmp/generators/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/test/dummy/tmp/generators/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 437d6254570e8b74952236076f3815f2176ad441
         | 
| 4 | 
            +
              data.tar.gz: ec345e6e33582186b6abd59c92629b57fb55cab0
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 586417ffc4189d2b29d8d93d2ab34c07f7b977ec669e9148a259b53419af6de7d4e68236c3b85398d5d4fbe8851cbde78e124db223b8bffc90ab6b1373ccd32b
         | 
| 7 | 
            +
              data.tar.gz: a791f36a4adee4063e41e99cca01956b4882926b410fbcc2357c6b09d21aea09d2fe296c1d4b842f78455e97e175fc3e8be67a27071190f4a2b28872fd021d15
         | 
    
        data/README.md
    CHANGED
    
    | @@ -42,7 +42,7 @@ The fully configured api used in the demo can be found [here](https://github.com | |
| 42 42 | 
             
              * [Controller Integration](#controller-concerns)
         | 
| 43 43 | 
             
              * [Model Integration](#model-concerns)
         | 
| 44 44 | 
             
              * [Using Multiple User Classes](#using-multiple-models)
         | 
| 45 | 
            -
              * [ | 
| 45 | 
            +
              * [Excluding Modules](#excluding-modules)
         | 
| 46 46 | 
             
              * [Custom Controller Overrides](#custom-controller-overrides)
         | 
| 47 47 | 
             
              * [Email Template Overrides](#email-template-overrides)
         | 
| 48 48 | 
             
            * [Conceptual Diagrams](#conceptual)
         | 
| @@ -507,24 +507,67 @@ In the above example, the following methods will be available (in addition to `c | |
| 507 507 | 
             
              * `current_member`
         | 
| 508 508 | 
             
              * `member_signed_in?`
         | 
| 509 509 |  | 
| 510 | 
            -
            ##  | 
| 510 | 
            +
            ## Excluding Modules
         | 
| 511 511 |  | 
| 512 | 
            -
            By default,  | 
| 512 | 
            +
            By default, almost all of the Devise modules are included:
         | 
| 513 | 
            +
            * [`database_authenticatable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/database_authenticatable.rb)
         | 
| 514 | 
            +
            * [`registerable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/registerable.rb)
         | 
| 515 | 
            +
            * [`recoverable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/recoverable.rb)
         | 
| 516 | 
            +
            * [`trackable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/trackable.rb)
         | 
| 517 | 
            +
            * [`validatable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/validatable.rb)
         | 
| 518 | 
            +
            * [`confirmable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/confirmable.rb)
         | 
| 519 | 
            +
            * [`omniauthable`](https://github.com/plataformatec/devise/blob/master/lib/devise/models/omniauthable.rb)
         | 
| 513 520 |  | 
| 514 | 
            -
             | 
| 521 | 
            +
            You may not want all of these features enabled in your app. That's OK! You can customize them to suit your own unique style.
         | 
| 515 522 |  | 
| 516 | 
            -
             | 
| 523 | 
            +
            The following example shows how to disable email confirmation.
         | 
| 524 | 
            +
             | 
| 525 | 
            +
            ##### Example: disable email confirmation
         | 
| 526 | 
            +
             | 
| 527 | 
            +
            Just list the devise modules that you want to include **before** including the `DeviseTokenAuth::Concerns::User` model concern.
         | 
| 517 528 |  | 
| 518 529 | 
             
            ~~~ruby
         | 
| 530 | 
            +
            # app/models/user.rb
         | 
| 519 531 | 
             
            class User < ActiveRecord::Base
         | 
| 532 | 
            +
             | 
| 533 | 
            +
              # notice this comes BEFORE the include statement below
         | 
| 534 | 
            +
              # also notice that :confirmable is not included in this block
         | 
| 535 | 
            +
              devise :database_authenticatable,
         | 
| 536 | 
            +
                     :recoverable, :trackable, :validatable,
         | 
| 537 | 
            +
                     :registerable, :omniauthable
         | 
| 538 | 
            +
             | 
| 539 | 
            +
              # note that this include statement comes AFTER the devise block above
         | 
| 520 540 | 
             
              include DeviseTokenAuth::Concerns::User
         | 
| 521 | 
            -
              before_create :skip_confirmation!
         | 
| 522 541 | 
             
            end
         | 
| 523 542 | 
             
            ~~~
         | 
| 524 543 |  | 
| 525 | 
            -
             | 
| 544 | 
            +
            Some features include routes that you may not want mounted to your app. The following example shows how to disable OAuth and its routes.
         | 
| 545 | 
            +
             | 
| 546 | 
            +
            ##### Example: disable OAuth authentication
         | 
| 547 | 
            +
             | 
| 548 | 
            +
            First instruct the model not to include the `omniauthable` module.
         | 
| 549 | 
            +
             | 
| 550 | 
            +
            ~~~ruby
         | 
| 551 | 
            +
            # app/models/user.rb
         | 
| 552 | 
            +
            class User < ActiveRecord::Base
         | 
| 553 | 
            +
             | 
| 554 | 
            +
              # notice that :omniauthable is not included in this block
         | 
| 555 | 
            +
              devise :database_authenticatable, :confirmable,
         | 
| 556 | 
            +
                     :recoverable, :trackable, :validatable,
         | 
| 557 | 
            +
                     :registerable, :omniauthable
         | 
| 526 558 |  | 
| 527 | 
            -
             | 
| 559 | 
            +
              include DeviseTokenAuth::Concerns::User
         | 
| 560 | 
            +
            end
         | 
| 561 | 
            +
            ~~~
         | 
| 562 | 
            +
             | 
| 563 | 
            +
            Now tell the route helper to `skip` mounting the `omniauth_callbacks` controller:
         | 
| 564 | 
            +
             | 
| 565 | 
            +
            ~~~ruby
         | 
| 566 | 
            +
            Rails.application.routes.draw do
         | 
| 567 | 
            +
              # config/routes.rb
         | 
| 568 | 
            +
              mount_devise_token_auth_for 'User', at: '/auth', skip: [:omniauth_callbacks]
         | 
| 569 | 
            +
            end
         | 
| 570 | 
            +
            ~~~
         | 
| 528 571 |  | 
| 529 572 | 
             
            ## Custom Controller Overrides
         | 
| 530 573 |  | 
| @@ -17,7 +17,7 @@ module DeviseTokenAuth | |
| 17 17 | 
             
                  end
         | 
| 18 18 |  | 
| 19 19 | 
             
                  # success redirect url is required
         | 
| 20 | 
            -
                   | 
| 20 | 
            +
                  if resource_class.devise_modules.include?(:confirmable) && !params[:confirm_success_url]
         | 
| 21 21 | 
             
                    return render json: {
         | 
| 22 22 | 
             
                      status: 'error',
         | 
| 23 23 | 
             
                      data:   @resource,
         | 
| @@ -76,7 +76,7 @@ module DeviseTokenAuth | |
| 76 76 |  | 
| 77 77 | 
             
                def update
         | 
| 78 78 | 
             
                  if @resource
         | 
| 79 | 
            -
             | 
| 79 | 
            +
             | 
| 80 80 | 
             
                    if @resource.update_attributes(account_update_params)
         | 
| 81 81 | 
             
                      render json: {
         | 
| 82 82 | 
             
                        status: 'success',
         | 
| @@ -2,11 +2,12 @@ module DeviseTokenAuth::Concerns::User | |
| 2 2 | 
             
              extend ActiveSupport::Concern
         | 
| 3 3 |  | 
| 4 4 | 
             
              included do
         | 
| 5 | 
            -
                #  | 
| 6 | 
            -
                 | 
| 7 | 
            -
             | 
| 8 | 
            -
                      :recoverable, : | 
| 5 | 
            +
                # Hack to check if devise is already enabled
         | 
| 6 | 
            +
                unless self.method_defined?(:devise_modules)
         | 
| 7 | 
            +
                  devise :database_authenticatable, :registerable,
         | 
| 8 | 
            +
                      :recoverable, :trackable, :validatable,
         | 
| 9 9 | 
             
                      :confirmable, :omniauthable
         | 
| 10 | 
            +
                end
         | 
| 10 11 |  | 
| 11 12 | 
             
                serialize :tokens, JSON
         | 
| 12 13 |  | 
| @@ -186,6 +187,9 @@ module DeviseTokenAuth::Concerns::User | |
| 186 187 | 
             
                return build_auth_header(token, client_id)
         | 
| 187 188 | 
             
              end
         | 
| 188 189 |  | 
| 190 | 
            +
              def confirmed?
         | 
| 191 | 
            +
                self.devise_modules.exclude?(:confirmable) || super
         | 
| 192 | 
            +
              end
         | 
| 189 193 |  | 
| 190 194 | 
             
              protected
         | 
| 191 195 |  | 
| @@ -30,6 +30,10 @@ module DeviseTokenAuth | |
| 30 30 | 
             
                    inclusion = "include DeviseTokenAuth::Concerns::User"
         | 
| 31 31 | 
             
                    unless parse_file_for_line(fname, inclusion)
         | 
| 32 32 | 
             
                      inject_into_file fname, after: "class #{user_class} < ActiveRecord::Base\n" do <<-'RUBY'
         | 
| 33 | 
            +
              # Include default devise modules.
         | 
| 34 | 
            +
              devise :database_authenticatable, :registerable,
         | 
| 35 | 
            +
                      :recoverable, :rememberable, :trackable, :validatable,
         | 
| 36 | 
            +
                      :confirmable, :omniauthable
         | 
| 33 37 | 
             
              include DeviseTokenAuth::Concerns::User
         | 
| 34 38 | 
             
                      RUBY
         | 
| 35 39 | 
             
                      end
         | 
| @@ -164,4 +164,14 @@ class OmniauthTest < ActionDispatch::IntegrationTest | |
| 164 164 | 
             
                  end
         | 
| 165 165 | 
             
                end
         | 
| 166 166 | 
             
              end
         | 
| 167 | 
            +
             | 
| 168 | 
            +
              describe 'User with only :database_authenticatable and :registerable included' do
         | 
| 169 | 
            +
                test 'OnlyEmailUser should not be able to use OAuth' do
         | 
| 170 | 
            +
                  assert_raises(ActionController::RoutingError) {
         | 
| 171 | 
            +
                    get_via_redirect '/only_email_auth/facebook', {
         | 
| 172 | 
            +
                      auth_origin_url: @redirect_url
         | 
| 173 | 
            +
                    }
         | 
| 174 | 
            +
                  }
         | 
| 175 | 
            +
                end
         | 
| 176 | 
            +
              end
         | 
| 167 177 | 
             
            end
         | 
| @@ -454,5 +454,50 @@ class DeviseTokenAuth::RegistrationsControllerTest < ActionDispatch::Integration | |
| 454 454 | 
             
                    assert @resource.valid_token?(@token, @client_id)
         | 
| 455 455 | 
             
                  end
         | 
| 456 456 | 
             
                end
         | 
| 457 | 
            +
             | 
| 458 | 
            +
             | 
| 459 | 
            +
                describe 'User with only :database_authenticatable and :registerable included' do
         | 
| 460 | 
            +
                  setup do
         | 
| 461 | 
            +
                    @mails_sent = ActionMailer::Base.deliveries.count
         | 
| 462 | 
            +
             | 
| 463 | 
            +
                    post '/only_email_auth', {
         | 
| 464 | 
            +
                      email: Faker::Internet.email,
         | 
| 465 | 
            +
                      password: "secret123",
         | 
| 466 | 
            +
                      password_confirmation: "secret123",
         | 
| 467 | 
            +
                      confirm_success_url: Faker::Internet.url,
         | 
| 468 | 
            +
                      unpermitted_param: '(x_x)'
         | 
| 469 | 
            +
                    }
         | 
| 470 | 
            +
             | 
| 471 | 
            +
                    @resource = assigns(:resource)
         | 
| 472 | 
            +
                    @data = JSON.parse(response.body)
         | 
| 473 | 
            +
                    @mail = ActionMailer::Base.deliveries.last
         | 
| 474 | 
            +
                  end
         | 
| 475 | 
            +
             | 
| 476 | 
            +
                  test 'user was created' do
         | 
| 477 | 
            +
                    assert @resource.id
         | 
| 478 | 
            +
                  end
         | 
| 479 | 
            +
             | 
| 480 | 
            +
                  test 'email confirmation was not sent' do
         | 
| 481 | 
            +
                    assert_equal @mails_sent, ActionMailer::Base.deliveries.count
         | 
| 482 | 
            +
                  end
         | 
| 483 | 
            +
             | 
| 484 | 
            +
                  test 'user is confirmed' do
         | 
| 485 | 
            +
                    assert @resource.confirmed?
         | 
| 486 | 
            +
                  end
         | 
| 487 | 
            +
                end
         | 
| 488 | 
            +
             | 
| 489 | 
            +
                describe 'User with registration routes disabled' do
         | 
| 490 | 
            +
                  test 'OnlyEmailUser should not be able to use OAuth' do
         | 
| 491 | 
            +
                    assert_raises(ActionController::RoutingError) {
         | 
| 492 | 
            +
                      post '/unregisterable_user_auth', {
         | 
| 493 | 
            +
                        email: Faker::Internet.email,
         | 
| 494 | 
            +
                        password: "secret123",
         | 
| 495 | 
            +
                        password_confirmation: "secret123",
         | 
| 496 | 
            +
                        confirm_success_url: Faker::Internet.url,
         | 
| 497 | 
            +
                        unpermitted_param: '(x_x)'
         | 
| 498 | 
            +
                      }
         | 
| 499 | 
            +
                    }
         | 
| 500 | 
            +
                  end
         | 
| 501 | 
            +
                end
         | 
| 457 502 | 
             
              end
         | 
| 458 503 | 
             
            end
         | 
| @@ -217,5 +217,33 @@ class DeviseTokenAuth::SessionsControllerTest < ActionController::TestCase | |
| 217 217 | 
             
                    assert_equal @existing_user.email, @data['data']['email']
         | 
| 218 218 | 
             
                  end
         | 
| 219 219 | 
             
                end
         | 
| 220 | 
            +
             | 
| 221 | 
            +
                describe 'User with only :database_authenticatable and :registerable included' do
         | 
| 222 | 
            +
                  setup do
         | 
| 223 | 
            +
                    @request.env['devise.mapping'] = Devise.mappings[:only_email_user]
         | 
| 224 | 
            +
                  end
         | 
| 225 | 
            +
             | 
| 226 | 
            +
                  teardown do
         | 
| 227 | 
            +
                    @request.env['devise.mapping'] = Devise.mappings[:user]
         | 
| 228 | 
            +
                  end
         | 
| 229 | 
            +
             | 
| 230 | 
            +
                  before do
         | 
| 231 | 
            +
                    @existing_user = only_email_users(:user)
         | 
| 232 | 
            +
                    @existing_user.save!
         | 
| 233 | 
            +
             | 
| 234 | 
            +
                    xhr :post, :create, {
         | 
| 235 | 
            +
                      email: @existing_user.email,
         | 
| 236 | 
            +
                      password: 'secret123'
         | 
| 237 | 
            +
                    }
         | 
| 238 | 
            +
             | 
| 239 | 
            +
                    @resource = assigns(:resource)
         | 
| 240 | 
            +
                    @data = JSON.parse(response.body)
         | 
| 241 | 
            +
                  end
         | 
| 242 | 
            +
             | 
| 243 | 
            +
                  test 'user should be able to sign in without confirmation' do
         | 
| 244 | 
            +
                    assert 200, response.status
         | 
| 245 | 
            +
                    refute OnlyEmailUser.method_defined?(:confirmed_at)
         | 
| 246 | 
            +
                  end
         | 
| 247 | 
            +
                end
         | 
| 220 248 | 
             
              end
         | 
| 221 249 | 
             
            end
         | 
    
        data/test/dummy/config/routes.rb
    CHANGED
    
    | @@ -19,6 +19,10 @@ Rails.application.routes.draw do | |
| 19 19 | 
             
                token_validations:  'overrides/token_validations'
         | 
| 20 20 | 
             
              }
         | 
| 21 21 |  | 
| 22 | 
            +
              mount_devise_token_auth_for 'OnlyEmailUser', at: '/only_email_auth', skip: [:omniauth_callbacks]
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              mount_devise_token_auth_for 'UnregisterableUser', at: '/unregisterable_user_auth', skip: [:registrations]
         | 
| 25 | 
            +
             | 
| 22 26 | 
             
              # this route will authorize visitors using the User class
         | 
| 23 27 | 
             
              get 'demo/members_only', to: 'demo_user#members_only'
         | 
| 24 28 |  | 
| Binary file | 
| @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            class DeviseTokenAuthCreateOnlyEmailUsers < ActiveRecord::Migration
         | 
| 2 | 
            +
              def change
         | 
| 3 | 
            +
                create_table(:only_email_users) do |t|
         | 
| 4 | 
            +
                  ## Required
         | 
| 5 | 
            +
                  t.string :provider, :null => false
         | 
| 6 | 
            +
                  t.string :uid, :null => false, :default => ""
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  ## Database authenticatable
         | 
| 9 | 
            +
                  t.string :encrypted_password, :null => false, :default => ""
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  ## Recoverable
         | 
| 12 | 
            +
                  #t.string   :reset_password_token
         | 
| 13 | 
            +
                  #t.datetime :reset_password_sent_at
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  ## Rememberable
         | 
| 16 | 
            +
                  #t.datetime :remember_created_at
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  ## Trackable
         | 
| 19 | 
            +
                  #t.integer  :sign_in_count, :default => 0, :null => false
         | 
| 20 | 
            +
                  #t.datetime :current_sign_in_at
         | 
| 21 | 
            +
                  #t.datetime :last_sign_in_at
         | 
| 22 | 
            +
                  #t.string   :current_sign_in_ip
         | 
| 23 | 
            +
                  #t.string   :last_sign_in_ip
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  ## Confirmable
         | 
| 26 | 
            +
                  #t.string   :confirmation_token
         | 
| 27 | 
            +
                  #t.datetime :confirmed_at
         | 
| 28 | 
            +
                  #t.datetime :confirmation_sent_at
         | 
| 29 | 
            +
                  #t.string   :unconfirmed_email # Only if using reconfirmable
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  ## Lockable
         | 
| 32 | 
            +
                  # t.integer  :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
         | 
| 33 | 
            +
                  # t.string   :unlock_token # Only if unlock strategy is :email or :both
         | 
| 34 | 
            +
                  # t.datetime :locked_at
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  ## User Info
         | 
| 37 | 
            +
                  t.string :name
         | 
| 38 | 
            +
                  t.string :nickname
         | 
| 39 | 
            +
                  t.string :image
         | 
| 40 | 
            +
                  t.string :email
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  ## Tokens
         | 
| 43 | 
            +
                  t.text :tokens
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  t.timestamps
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                add_index :only_email_users, :email
         | 
| 49 | 
            +
                add_index :only_email_users, [:uid, :provider],     :unique => true
         | 
| 50 | 
            +
                #add_index :only_email_users, :reset_password_token, :unique => true
         | 
| 51 | 
            +
                # add_index :only_email_users, :confirmation_token,   :unique => true
         | 
| 52 | 
            +
                # add_index :only_email_users, :unlock_token,         :unique => true
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
            end
         | 
| @@ -0,0 +1,54 @@ | |
| 1 | 
            +
            class DeviseTokenAuthCreateUnregisterableUsers < ActiveRecord::Migration
         | 
| 2 | 
            +
              def change
         | 
| 3 | 
            +
                create_table(:unregisterable_users) do |t|
         | 
| 4 | 
            +
                  ## Required
         | 
| 5 | 
            +
                  t.string :provider, :null => false
         | 
| 6 | 
            +
                  t.string :uid, :null => false, :default => ""
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  ## Database authenticatable
         | 
| 9 | 
            +
                  t.string :encrypted_password, :null => false, :default => ""
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  ## Recoverable
         | 
| 12 | 
            +
                  t.string   :reset_password_token
         | 
| 13 | 
            +
                  t.datetime :reset_password_sent_at
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  ## Rememberable
         | 
| 16 | 
            +
                  t.datetime :remember_created_at
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  ## Trackable
         | 
| 19 | 
            +
                  t.integer  :sign_in_count, :default => 0, :null => false
         | 
| 20 | 
            +
                  t.datetime :current_sign_in_at
         | 
| 21 | 
            +
                  t.datetime :last_sign_in_at
         | 
| 22 | 
            +
                  t.string   :current_sign_in_ip
         | 
| 23 | 
            +
                  t.string   :last_sign_in_ip
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                  ## Confirmable
         | 
| 26 | 
            +
                  t.string   :confirmation_token
         | 
| 27 | 
            +
                  t.datetime :confirmed_at
         | 
| 28 | 
            +
                  t.datetime :confirmation_sent_at
         | 
| 29 | 
            +
                  t.string   :unconfirmed_email # Only if using reconfirmable
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  ## Lockable
         | 
| 32 | 
            +
                  # t.integer  :failed_attempts, :default => 0, :null => false # Only if lock strategy is :failed_attempts
         | 
| 33 | 
            +
                  # t.string   :unlock_token # Only if unlock strategy is :email or :both
         | 
| 34 | 
            +
                  # t.datetime :locked_at
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                  ## User Info
         | 
| 37 | 
            +
                  t.string :name
         | 
| 38 | 
            +
                  t.string :nickname
         | 
| 39 | 
            +
                  t.string :image
         | 
| 40 | 
            +
                  t.string :email
         | 
| 41 | 
            +
             | 
| 42 | 
            +
                  ## Tokens
         | 
| 43 | 
            +
                  t.text :tokens
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                  t.timestamps
         | 
| 46 | 
            +
                end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
                add_index :unregisterable_users, :email
         | 
| 49 | 
            +
                add_index :unregisterable_users, [:uid, :provider],     :unique => true
         | 
| 50 | 
            +
                add_index :unregisterable_users, :reset_password_token, :unique => true
         | 
| 51 | 
            +
                # add_index :unregisterable_users, :confirmation_token,   :unique => true
         | 
| 52 | 
            +
                # add_index :unregisterable_users, :unlock_token,         :unique => true
         | 
| 53 | 
            +
              end
         | 
| 54 | 
            +
            end
         | 
    
        data/test/dummy/db/schema.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ | |
| 11 11 | 
             
            #
         | 
| 12 12 | 
             
            # It's strongly recommended that you check this file into your version control system.
         | 
| 13 13 |  | 
| 14 | 
            -
            ActiveRecord::Schema.define(version:  | 
| 14 | 
            +
            ActiveRecord::Schema.define(version: 20141222053502) do
         | 
| 15 15 |  | 
| 16 16 | 
             
              create_table "evil_users", force: true do |t|
         | 
| 17 17 | 
             
                t.string   "email"
         | 
| @@ -77,6 +77,51 @@ ActiveRecord::Schema.define(version: 20140928231203) do | |
| 77 77 | 
             
              add_index "mangs", ["reset_password_token"], name: "index_mangs_on_reset_password_token", unique: true
         | 
| 78 78 | 
             
              add_index "mangs", ["uid", "provider"], name: "index_mangs_on_uid_and_provider", unique: true
         | 
| 79 79 |  | 
| 80 | 
            +
              create_table "only_email_users", force: true do |t|
         | 
| 81 | 
            +
                t.string   "provider",                        null: false
         | 
| 82 | 
            +
                t.string   "uid",                default: "", null: false
         | 
| 83 | 
            +
                t.string   "encrypted_password", default: "", null: false
         | 
| 84 | 
            +
                t.string   "name"
         | 
| 85 | 
            +
                t.string   "nickname"
         | 
| 86 | 
            +
                t.string   "image"
         | 
| 87 | 
            +
                t.string   "email"
         | 
| 88 | 
            +
                t.text     "tokens"
         | 
| 89 | 
            +
                t.datetime "created_at"
         | 
| 90 | 
            +
                t.datetime "updated_at"
         | 
| 91 | 
            +
              end
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              add_index "only_email_users", ["email"], name: "index_only_email_users_on_email"
         | 
| 94 | 
            +
              add_index "only_email_users", ["uid", "provider"], name: "index_only_email_users_on_uid_and_provider", unique: true
         | 
| 95 | 
            +
             | 
| 96 | 
            +
              create_table "unregisterable_users", force: true do |t|
         | 
| 97 | 
            +
                t.string   "provider",                            null: false
         | 
| 98 | 
            +
                t.string   "uid",                    default: "", null: false
         | 
| 99 | 
            +
                t.string   "encrypted_password",     default: "", null: false
         | 
| 100 | 
            +
                t.string   "reset_password_token"
         | 
| 101 | 
            +
                t.datetime "reset_password_sent_at"
         | 
| 102 | 
            +
                t.datetime "remember_created_at"
         | 
| 103 | 
            +
                t.integer  "sign_in_count",          default: 0,  null: false
         | 
| 104 | 
            +
                t.datetime "current_sign_in_at"
         | 
| 105 | 
            +
                t.datetime "last_sign_in_at"
         | 
| 106 | 
            +
                t.string   "current_sign_in_ip"
         | 
| 107 | 
            +
                t.string   "last_sign_in_ip"
         | 
| 108 | 
            +
                t.string   "confirmation_token"
         | 
| 109 | 
            +
                t.datetime "confirmed_at"
         | 
| 110 | 
            +
                t.datetime "confirmation_sent_at"
         | 
| 111 | 
            +
                t.string   "unconfirmed_email"
         | 
| 112 | 
            +
                t.string   "name"
         | 
| 113 | 
            +
                t.string   "nickname"
         | 
| 114 | 
            +
                t.string   "image"
         | 
| 115 | 
            +
                t.string   "email"
         | 
| 116 | 
            +
                t.text     "tokens"
         | 
| 117 | 
            +
                t.datetime "created_at"
         | 
| 118 | 
            +
                t.datetime "updated_at"
         | 
| 119 | 
            +
              end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
              add_index "unregisterable_users", ["email"], name: "index_unregisterable_users_on_email"
         | 
| 122 | 
            +
              add_index "unregisterable_users", ["reset_password_token"], name: "index_unregisterable_users_on_reset_password_token", unique: true
         | 
| 123 | 
            +
              add_index "unregisterable_users", ["uid", "provider"], name: "index_unregisterable_users_on_uid_and_provider", unique: true
         | 
| 124 | 
            +
             | 
| 80 125 | 
             
              create_table "users", force: true do |t|
         | 
| 81 126 | 
             
                t.string   "email"
         | 
| 82 127 | 
             
                t.string   "encrypted_password",          default: "", null: false
         |