authn 2.4.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -23,11 +23,12 @@ To start using authn you simply need to install and hook up to your existing "us
23
23
 
24
24
  ``` ruby
25
25
  # create_table :accounts do |t|
26
- # t.string :email, null: false, default: nil
27
- # t.binary :password_digest, null: false, default: nil
26
+ # t.string :email
27
+ # t.binary :password_digest
28
+ #
28
29
  # t.timestamps
29
30
  # end
30
- # add_index :accounts, :email, unique: true
31
+ # add_index :accounts, :email
31
32
  #
32
33
 
33
34
  class Account < ActiveRecord::Base
@@ -50,34 +51,34 @@ We'll you can see their own pages, but here's a taste:
50
51
 
51
52
  ``` ruby
52
53
  # create_table :accounts do |t|
53
- # t.string :email, null: false, default: nil
54
- # t.binary :password_digest, null: false, default: nil
54
+ # t.string :email
55
+ # t.binary :password_digest
55
56
  #
56
- # t.string :activation_token, default: nil
57
- # t.boolean :activation_state, null: false, default: false
58
- # t.datetime :activation_expires_at, default: nil
57
+ # t.string :activation_token
58
+ # t.boolean :activation_state, default: false
59
+ # t.datetime :activation_expires_at
59
60
  #
60
- # t.string :password_recovery_token, default: nil
61
- # t.datetime :password_recovery_expires_at, default: nil
61
+ # t.string :password_recovery_token
62
+ # t.datetime :password_recovery_expires_at
62
63
  #
63
- # t.string :login_protection_token, default: nil
64
- # t.datetime :login_protection_expires_at, default: nil
64
+ # t.string :login_protection_token
65
+ # t.datetime :login_protection_expires_at
65
66
  # t.integer :login_protection_attempts, default: 0
66
67
  #
67
68
  # t.timestamps
68
69
  # end
69
- # add_index :accounts, :email, unique: true
70
- # add_index :accounts, :activation_token, unique: true
70
+ # add_index :accounts, :email
71
+ # add_index :accounts, :activation_token
71
72
  # add_index :accounts, :activation_state
72
- # add_index :accounts, :password_recovery_token, unique: true
73
- # add_index :accounts, :login_protection_token, unique: true
73
+ # add_index :accounts, :password_recovery_token
74
+ # add_index :accounts, :login_protection_token
74
75
  #
75
76
 
76
77
  class Account < ActiveRecord::Base
77
78
  include AuthN::Model
78
79
 
79
80
  has_authentication
80
- has_password_recovery mailer: PasswordRecoveryMailer
81
+ has_password_recovery mailer: "PasswordRecoveryMailer"
81
82
  has_activation mailer: "ActivationMailer", on_create: false
82
83
  has_login_protection maximum: 3, redirect: { controller: :accounts, action: :maximum_login_failure }
83
84
  has_secure_password
data/lib/authn/config.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  module AuthN
2
2
  def self.config
3
- @config ||= Config.new Config::DEFAULTS
3
+ @config ||= Config.new Config.defaults
4
4
  end
5
5
 
6
6
  class Config < AltStruct
7
- DEFAULTS = {
7
+ @@defaults = {
8
8
  password_digest_method: :password_digest,
9
9
  account_klass: "Account",
10
10
  login_password_key: :password,
@@ -12,5 +12,9 @@ module AuthN
12
12
  model_critera_method: :where,
13
13
  session_key_function: ->(klass) { :"session_#{klass}_id" }
14
14
  }
15
+
16
+ def self.defaults
17
+ @@defaults ||= {}
18
+ end
15
19
  end
16
20
  end
data/lib/authn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module AuthN
2
- VERSION = "2.4.0"
2
+ VERSION = "2.6.0"
3
3
  end
data/test/helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require_relative '../lib/authn'
1
+ require 'authn'
2
2
 
3
3
  module ActiveModel::Model
4
4
  def self.included(base)
@@ -3,6 +3,6 @@ require_relative '../../helper'
3
3
 
4
4
  class TestAuthNVersion < MiniTest::Unit::TestCase
5
5
  def test_that_version_is_latest
6
- assert_equal "2.4.0", AuthN::VERSION
6
+ assert_equal "2.6.0", AuthN::VERSION
7
7
  end
8
8
  end
@@ -7,6 +7,6 @@ class TestAuthN < MiniTest::Unit::TestCase
7
7
  end
8
8
 
9
9
  def test_that_AuthN_is_defined
10
- assert(defined?(:AuthN))
10
+ assert(defined?(AuthN))
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: 2678869267231838865
135
+ hash: 251754304822765398
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  segments:
143
143
  - 0
144
- hash: 2678869267231838865
144
+ hash: 251754304822765398
145
145
  requirements: []
146
146
  rubyforge_project:
147
147
  rubygems_version: 1.8.24