thincloud-authentication 0.4.0 → 0.5.0
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/app/controllers/thincloud/authentication/registrations_controller.rb +1 -1
- data/app/mailers/thincloud/authentication/registrations_mailer.rb +2 -2
- data/app/models/thincloud/authentication/identity.rb +0 -3
- data/lib/thincloud/authentication/authenticatable_controller.rb +8 -3
- data/lib/thincloud/authentication/engine.rb +3 -0
- data/lib/thincloud/authentication/version.rb +1 -1
- metadata +5 -5
@@ -32,7 +32,7 @@ module Thincloud::Authentication
|
|
32
32
|
if omniauth
|
33
33
|
login_as @identity.user
|
34
34
|
else
|
35
|
-
RegistrationsMailer.verification_token(@identity).deliver
|
35
|
+
RegistrationsMailer.verification_token(@identity.id).deliver
|
36
36
|
flash[:notice] = "Check your email to verify your registration."
|
37
37
|
end
|
38
38
|
redirect_to after_registration_path
|
@@ -4,8 +4,8 @@ module Thincloud::Authentication
|
|
4
4
|
default from: Thincloud::Authentication.configuration.mailer_sender
|
5
5
|
|
6
6
|
# New registration verification token
|
7
|
-
def verification_token(
|
8
|
-
@identity =
|
7
|
+
def verification_token(identity_id)
|
8
|
+
@identity = Identity.find(identity_id)
|
9
9
|
mail to: @identity.email, subject: "Identity Verification"
|
10
10
|
end
|
11
11
|
end
|
@@ -5,9 +5,6 @@ module Thincloud::Authentication
|
|
5
5
|
|
6
6
|
belongs_to :user
|
7
7
|
|
8
|
-
# Limit the ability to mass-assign sensitive fields.
|
9
|
-
attr_accessible :name, :email, :password, :password_confirmation
|
10
|
-
|
11
8
|
validates :name, presence: true
|
12
9
|
validates :email, presence: true, uniqueness: true, format: /@/
|
13
10
|
|
@@ -17,8 +17,8 @@ module Thincloud
|
|
17
17
|
#
|
18
18
|
# Returns: An instance of `User` or `nil`.
|
19
19
|
def current_user
|
20
|
-
return nil if
|
21
|
-
@current_user ||= User.find(
|
20
|
+
return nil if cookies.signed[:uid].blank?
|
21
|
+
@current_user ||= User.find(cookies.signed[:uid])
|
22
22
|
end
|
23
23
|
|
24
24
|
# Protected: Determine if the current request has a logged in user.
|
@@ -48,7 +48,11 @@ module Thincloud
|
|
48
48
|
# Returns: The `id` of the provided user.
|
49
49
|
def login_as(user)
|
50
50
|
reset_session # avoid session fixation
|
51
|
-
|
51
|
+
cookies.signed[:uid] = {
|
52
|
+
value: user.id,
|
53
|
+
secure: request.ssl?,
|
54
|
+
httponly: true
|
55
|
+
}
|
52
56
|
end
|
53
57
|
|
54
58
|
# Protected: Clear the session of an authenticated user.
|
@@ -56,6 +60,7 @@ module Thincloud
|
|
56
60
|
# Returns: A new empty session instance.
|
57
61
|
def logout
|
58
62
|
reset_session
|
63
|
+
cookies.delete(:uid)
|
59
64
|
end
|
60
65
|
|
61
66
|
# Protected: Provides the URL to redirect to after logging in.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thincloud-authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
segments:
|
141
141
|
- 0
|
142
|
-
hash:
|
142
|
+
hash: 95031212902232703
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
none: false
|
145
145
|
requirements:
|
@@ -148,10 +148,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash:
|
151
|
+
hash: 95031212902232703
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.8.
|
154
|
+
rubygems_version: 1.8.23
|
155
155
|
signing_key:
|
156
156
|
specification_version: 3
|
157
157
|
summary: Rails Engine to provide authentication for Thincloud applications
|