currentuser-services 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/VERSION +1 -1
- data/app/controllers/currentuser/services/sessions_controller.rb +8 -2
- data/currentuser-services.gemspec +3 -3
- data/lib/currentuser/services/controllers/authenticates.rb +1 -1
- data/test/currentuser/services/authenticates_test.rb +4 -4
- data/test/currentuser/services/sessions_controller_test.rb +5 -5
- data/test/test_application/application.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bed2624d3407bf18098ccda4f4091a6c1b16403
|
4
|
+
data.tar.gz: 43aaead3751bb9df1d2f6da1b76506eac57811d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76cd438c0731a783f151c4502b7cc979f806d9fe987c9521e2ce41f5a07ad3891176e6c2d23a99067c5d94b9c9fb8aaa6e76a79a1fb83c60840e63663ce61378
|
7
|
+
data.tar.gz: fb8b4e25f8e857a3aa7c2d2072e01a86ddc7c7eb1616c1f70cdc1d3f3d865c08032cbfd65780d75e3f5ea33461c911825d17ef5728041f040ed933d6b190047e
|
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -5,10 +5,16 @@ module Currentuser
|
|
5
5
|
def sign_in
|
6
6
|
Services.check_authentication_params!(params)
|
7
7
|
|
8
|
+
# Note: in this method, we create an hash with string keys because, with Rails 4.2.0, keys are stringified
|
9
|
+
# between two requests if session is stored in a json cookie (which is the default behavior for Rails 4.2.0).
|
10
|
+
hash = {}
|
11
|
+
|
8
12
|
# Log in
|
9
|
-
|
13
|
+
hash['id'] = params[:currentuser_id]
|
10
14
|
# Note that params[:sign_up] should equal 'true' (String) or should be absent.
|
11
|
-
|
15
|
+
hash['sign_up'] = true if params[:sign_up]
|
16
|
+
|
17
|
+
session[:currentuser] = hash
|
12
18
|
|
13
19
|
redirect_to '/'
|
14
20
|
end
|
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: currentuser-services 0.2.
|
5
|
+
# stub: currentuser-services 0.2.3 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "currentuser-services"
|
9
|
-
s.version = "0.2.
|
9
|
+
s.version = "0.2.3"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["eric-currentuser"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-03-04"
|
15
15
|
s.description = "Offsite sign up and sign in forms for Currentuser.io"
|
16
16
|
s.email = "TBD"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -30,7 +30,7 @@ module Currentuser
|
|
30
30
|
# require_currentuser
|
31
31
|
|
32
32
|
test 'execute action if currentuser_id is available' do
|
33
|
-
session[:currentuser] = {id
|
33
|
+
session[:currentuser] = {'id' => 'user_id_1'}
|
34
34
|
|
35
35
|
get_with_route :test_action_requiring_user
|
36
36
|
assert_response :ok
|
@@ -47,15 +47,15 @@ module Currentuser
|
|
47
47
|
# currentuser_session
|
48
48
|
|
49
49
|
test 'currentuser_session returns currentuser session' do
|
50
|
-
session[:currentuser] = {foo
|
50
|
+
session[:currentuser] = {'foo' => 'blah'}
|
51
51
|
|
52
|
-
assert_equal({foo
|
52
|
+
assert_equal({'foo' => 'blah'}, @controller.currentuser_session)
|
53
53
|
end
|
54
54
|
|
55
55
|
# currentuser_id
|
56
56
|
|
57
57
|
test 'currentuser_id returns currentuser ID' do
|
58
|
-
session[:currentuser] = {id
|
58
|
+
session[:currentuser] = {'id' => 'user_id_1'}
|
59
59
|
|
60
60
|
assert_equal 'user_id_1', @controller.currentuser_id
|
61
61
|
end
|
@@ -38,8 +38,8 @@ module Currentuser
|
|
38
38
|
end
|
39
39
|
|
40
40
|
assert_redirected_to '/'
|
41
|
-
assert_equal({id
|
42
|
-
refute session[:currentuser].has_key?(
|
41
|
+
assert_equal({'id' => user_id}, session[:currentuser])
|
42
|
+
refute session[:currentuser].has_key?('sign_up')
|
43
43
|
end
|
44
44
|
|
45
45
|
test 'sign_in sets sign_up if sign_up is true' do
|
@@ -54,7 +54,7 @@ module Currentuser
|
|
54
54
|
end
|
55
55
|
|
56
56
|
assert_redirected_to '/'
|
57
|
-
assert_equal true, session[:currentuser][
|
57
|
+
assert_equal true, session[:currentuser]['sign_up']
|
58
58
|
end
|
59
59
|
|
60
60
|
# This test proves that we use Services#check_authentication_params!
|
@@ -70,13 +70,13 @@ module Currentuser
|
|
70
70
|
# sign_out
|
71
71
|
|
72
72
|
test 'sign_out deletes session and redirects to root' do
|
73
|
-
session_hash = {currentuser: {foo
|
73
|
+
session_hash = {currentuser: {'foo' => 'blah'}, other_key: 'other_value'}
|
74
74
|
|
75
75
|
delete_with_route :sign_out, {}, session_hash
|
76
76
|
assert_redirected_to '/'
|
77
77
|
|
78
78
|
assert_nil session[:currentuser]
|
79
|
-
assert_equal
|
79
|
+
assert_equal 'other_value', session[:other_key]
|
80
80
|
end
|
81
81
|
|
82
82
|
# available
|
@@ -20,7 +20,7 @@ module TestRailsApp
|
|
20
20
|
render inline: "
|
21
21
|
Private page
|
22
22
|
<%= button_to 'Sign out', 'currentuser/sign_out', method: :delete %>
|
23
|
-
<% if currentuser_session[
|
23
|
+
<% if currentuser_session['sign_up'] %>Sign Up<% end %>
|
24
24
|
"
|
25
25
|
end
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: currentuser-services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eric-currentuser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gem_config
|