authpwn_rails 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.2
1
+ 0.7.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{authpwn_rails}
8
- s.version = "0.7.2"
8
+ s.version = "0.7.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
59
59
  ]
60
60
  s.homepage = %q{http://github.com/pwnall/authpwn_rails}
61
61
  s.require_paths = ["lib"]
62
- s.rubygems_version = %q{1.6.0}
62
+ s.rubygems_version = %q{1.5.3}
63
63
  s.summary = %q{User authentication for Rails 3 applications.}
64
64
  s.test_files = [
65
65
  "test/cookie_controller_test.rb",
@@ -109,7 +109,10 @@ module SessionControllerInstanceMethods
109
109
  unless performed?
110
110
  respond_to do |format|
111
111
  format.html { render :action => :home }
112
- format.json { render :json => @user }
112
+ format.json do
113
+ render :json => { :user => @user.serializable_hash,
114
+ :csrf => form_authenticity_token }
115
+ end
113
116
  end
114
117
  end
115
118
  end
@@ -125,7 +128,10 @@ module SessionControllerInstanceMethods
125
128
  respond_to do |format|
126
129
  if current_user
127
130
  format.html { redirect_to @redirect_url }
128
- format.json { render :json => current_user }
131
+ format.json do
132
+ render :json => { :user => current_user.serializable_hash,
133
+ :csrf => form_authenticity_token }
134
+ end
129
135
  else
130
136
  notice = 'Invalid e-mail or password'
131
137
  format.html do
@@ -43,6 +43,7 @@ class SessionControllerApiTest < ActionController::TestCase
43
43
  assert_response :ok
44
44
  data = ActiveSupport::JSON.decode response.body
45
45
  assert_equal @user.email, data['user']['email']
46
+ assert_equal session[:_csrf_token], data['csrf']
46
47
  assert_equal @user, assigns(:user), 'home controller method not called'
47
48
  end
48
49
 
@@ -88,6 +89,7 @@ class SessionControllerApiTest < ActionController::TestCase
88
89
  assert_response :ok
89
90
  data = ActiveSupport::JSON.decode response.body
90
91
  assert_equal @user.email, data['user']['email']
92
+ assert_equal session[:_csrf_token], data['csrf']
91
93
  assert_equal @user, assigns(:current_user), 'instance variable'
92
94
  assert_equal @user, session_current_user, 'session'
93
95
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authpwn_rails
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 2
10
- version: 0.7.2
9
+ - 3
10
+ version: 0.7.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Victor Costan
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  requirements: []
146
146
 
147
147
  rubyforge_project:
148
- rubygems_version: 1.6.0
148
+ rubygems_version: 1.5.3
149
149
  signing_key:
150
150
  specification_version: 3
151
151
  summary: User authentication for Rails 3 applications.