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 +18 -17
- data/lib/authn/config.rb +6 -2
- data/lib/authn/version.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/lib/authn/version_test.rb +1 -1
- data/test/lib/authn_test.rb +1 -1
- metadata +3 -3
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
|
27
|
-
# t.binary :password_digest
|
26
|
+
# t.string :email
|
27
|
+
# t.binary :password_digest
|
28
|
+
#
|
28
29
|
# t.timestamps
|
29
30
|
# end
|
30
|
-
# add_index :accounts, :email
|
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
|
54
|
-
# t.binary :password_digest
|
54
|
+
# t.string :email
|
55
|
+
# t.binary :password_digest
|
55
56
|
#
|
56
|
-
# t.string :activation_token
|
57
|
-
# t.boolean :activation_state,
|
58
|
-
# t.datetime :activation_expires_at
|
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
|
61
|
-
# t.datetime :password_recovery_expires_at
|
61
|
+
# t.string :password_recovery_token
|
62
|
+
# t.datetime :password_recovery_expires_at
|
62
63
|
#
|
63
|
-
# t.string :login_protection_token
|
64
|
-
# t.datetime :login_protection_expires_at
|
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
|
70
|
-
# add_index :accounts, :activation_token
|
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
|
73
|
-
# add_index :accounts, :login_protection_token
|
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
|
3
|
+
@config ||= Config.new Config.defaults
|
4
4
|
end
|
5
5
|
|
6
6
|
class Config < AltStruct
|
7
|
-
|
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
data/test/helper.rb
CHANGED
data/test/lib/authn_test.rb
CHANGED
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
|
+
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:
|
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:
|
144
|
+
hash: 251754304822765398
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
147
|
rubygems_version: 1.8.24
|