devise_wind 0.2.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,36 @@
1
1
  class SessionsController < Devise::SessionsController
2
- protect_from_forgery
3
- def new
4
- create
5
- redirect_to root_path
2
+ protect_from_forgery
3
+ def new
4
+ create
5
+ end
6
+
7
+ def create
8
+ resource = warden.authenticate!(auth_options)
9
+ set_flash_message(:notice, :signed_in) if is_navigational_format?
10
+ sign_in(resource_name, resource)
11
+ redirect_to after_sign_in_path_for(resource)
6
12
  end
13
+
14
+ def destroy
15
+ signed_in = signed_in?(resource_name)
16
+ redirect_url = after_sign_out_path_for(resource_name) || root_url
17
+
18
+ if redirect_url.match(/^\/$/)
19
+ redirect_url = root_url
20
+ end
21
+ Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)
22
+ set_flash_message :notice, :signed_out if signed_in
23
+
24
+ # We actually need to hardcode this as Rails default responder doesn't
25
+ # support returning empty response on GET request
26
+ respond_to do |format|
27
+ format.any(*navigational_formats) { redirect_to "https://#{User.wind_host}/logout?passthrough=1&destination=" + redirect_url }
28
+ format.all do
29
+ method = "to_#{request_format}"
30
+ text = {}.respond_to?(method) ? {}.send(method) : ""
31
+ render :text => text, :status => :ok
32
+ end
33
+ end
34
+ end
35
+
7
36
  end
data/app/models/user.rb CHANGED
@@ -1,4 +1,5 @@
1
- class User
1
+ require 'devise'
2
+ class User < ActiveRecord::Base
2
3
  devise :wind_authenticatable
3
4
 
4
5
  has_and_belongs_to_many :roles
data/config/routes.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- # devise_for :users, :controllers => {:sessions => 'sessions'}
2
+ #devise_for :users, :controllers => {:sessions => 'sessions'}
3
3
  end
data/lib/devise_wind.rb CHANGED
@@ -4,7 +4,6 @@ require 'nokogiri'
4
4
  require 'devise_wind/engine'
5
5
  require 'devise_wind/mixins/urls'
6
6
  require 'devise_wind/model'
7
- require 'devise_wind/schema'
8
7
  require 'devise_wind/strategy'
9
8
  require 'devise_wind/version'
10
9
  module DeviseWind
@@ -7,16 +7,13 @@ module Devise
7
7
  @wind_config = {}
8
8
  end
9
9
 
10
- module InstanceMethods
11
- def affiliations=(affils)
12
- # do nothing with affiliations by default, let implementers override this
13
- end
14
-
15
- def wind_login
16
- self.send self.class.wind_login_field
17
- end
18
-
19
- end # InstanceMethods
10
+ def affiliations=(affils)
11
+ # do nothing with affiliations by default, let implementers override this
12
+ end
13
+
14
+ def wind_login
15
+ self.send self.class.wind_login_field
16
+ end
20
17
 
21
18
  module ClassMethods
22
19
  # The name of the wind login field in the database.
@@ -1,3 +1,3 @@
1
1
  module DeviseWind
2
- VERSION = '0.2.4'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_wind
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 2
9
- - 4
10
- version: 0.2.4
9
+ - 0
10
+ version: 1.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Benjamin Armintor, James Stuart
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-18 00:00:00 Z
18
+ date: 2012-06-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -40,18 +40,31 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 5
43
+ hash: 1
44
44
  segments:
45
+ - 2
45
46
  - 1
46
- - 5
47
- - 3
48
- version: 1.5.3
47
+ version: "2.1"
49
48
  type: :runtime
50
49
  version_requirements: *id002
51
50
  - !ruby/object:Gem::Dependency
52
- name: warden
51
+ name: devise-encryptable
53
52
  prerelease: false
54
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ type: :runtime
63
+ version_requirements: *id003
64
+ - !ruby/object:Gem::Dependency
65
+ name: warden
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
55
68
  none: false
56
69
  requirements:
57
70
  - - ~>
@@ -62,11 +75,11 @@ dependencies:
62
75
  - 1
63
76
  version: "1.1"
64
77
  type: :runtime
65
- version_requirements: *id003
78
+ version_requirements: *id004
66
79
  - !ruby/object:Gem::Dependency
67
80
  name: nokogiri
68
81
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
82
+ requirement: &id005 !ruby/object:Gem::Requirement
70
83
  none: false
71
84
  requirements:
72
85
  - - ">="
@@ -76,11 +89,11 @@ dependencies:
76
89
  - 0
77
90
  version: "0"
78
91
  type: :runtime
79
- version_requirements: *id004
92
+ version_requirements: *id005
80
93
  - !ruby/object:Gem::Dependency
81
94
  name: yard
82
95
  prerelease: false
83
- requirement: &id005 !ruby/object:Gem::Requirement
96
+ requirement: &id006 !ruby/object:Gem::Requirement
84
97
  none: false
85
98
  requirements:
86
99
  - - ">="
@@ -90,11 +103,11 @@ dependencies:
90
103
  - 0
91
104
  version: "0"
92
105
  type: :development
93
- version_requirements: *id005
106
+ version_requirements: *id006
94
107
  - !ruby/object:Gem::Dependency
95
108
  name: ruby-debug
96
109
  prerelease: false
97
- requirement: &id006 !ruby/object:Gem::Requirement
110
+ requirement: &id007 !ruby/object:Gem::Requirement
98
111
  none: false
99
112
  requirements:
100
113
  - - ">="
@@ -104,11 +117,11 @@ dependencies:
104
117
  - 0
105
118
  version: "0"
106
119
  type: :development
107
- version_requirements: *id006
120
+ version_requirements: *id007
108
121
  - !ruby/object:Gem::Dependency
109
122
  name: ruby-debug-base
110
123
  prerelease: false
111
- requirement: &id007 !ruby/object:Gem::Requirement
124
+ requirement: &id008 !ruby/object:Gem::Requirement
112
125
  none: false
113
126
  requirements:
114
127
  - - ">="
@@ -118,11 +131,11 @@ dependencies:
118
131
  - 0
119
132
  version: "0"
120
133
  type: :development
121
- version_requirements: *id007
134
+ version_requirements: *id008
122
135
  - !ruby/object:Gem::Dependency
123
136
  name: rspec-rails
124
137
  prerelease: false
125
- requirement: &id008 !ruby/object:Gem::Requirement
138
+ requirement: &id009 !ruby/object:Gem::Requirement
126
139
  none: false
127
140
  requirements:
128
141
  - - ">="
@@ -134,11 +147,11 @@ dependencies:
134
147
  - 0
135
148
  version: 2.10.0
136
149
  type: :development
137
- version_requirements: *id008
150
+ version_requirements: *id009
138
151
  - !ruby/object:Gem::Dependency
139
152
  name: mocha
140
153
  prerelease: false
141
- requirement: &id009 !ruby/object:Gem::Requirement
154
+ requirement: &id010 !ruby/object:Gem::Requirement
142
155
  none: false
143
156
  requirements:
144
157
  - - ">="
@@ -148,11 +161,11 @@ dependencies:
148
161
  - 0
149
162
  version: "0"
150
163
  type: :development
151
- version_requirements: *id009
164
+ version_requirements: *id010
152
165
  - !ruby/object:Gem::Dependency
153
166
  name: cucumber
154
167
  prerelease: false
155
- requirement: &id010 !ruby/object:Gem::Requirement
168
+ requirement: &id011 !ruby/object:Gem::Requirement
156
169
  none: false
157
170
  requirements:
158
171
  - - ">="
@@ -164,11 +177,11 @@ dependencies:
164
177
  - 5
165
178
  version: 0.8.5
166
179
  type: :development
167
- version_requirements: *id010
180
+ version_requirements: *id011
168
181
  - !ruby/object:Gem::Dependency
169
182
  name: cucumber-rails
170
183
  prerelease: false
171
- requirement: &id011 !ruby/object:Gem::Requirement
184
+ requirement: &id012 !ruby/object:Gem::Requirement
172
185
  none: false
173
186
  requirements:
174
187
  - - ">="
@@ -180,11 +193,11 @@ dependencies:
180
193
  - 0
181
194
  version: 1.0.0
182
195
  type: :development
183
- version_requirements: *id011
196
+ version_requirements: *id012
184
197
  - !ruby/object:Gem::Dependency
185
198
  name: gherkin
186
199
  prerelease: false
187
- requirement: &id012 !ruby/object:Gem::Requirement
200
+ requirement: &id013 !ruby/object:Gem::Requirement
188
201
  none: false
189
202
  requirements:
190
203
  - - ">="
@@ -194,11 +207,11 @@ dependencies:
194
207
  - 0
195
208
  version: "0"
196
209
  type: :development
197
- version_requirements: *id012
210
+ version_requirements: *id013
198
211
  - !ruby/object:Gem::Dependency
199
212
  name: factory_girl
200
213
  prerelease: false
201
- requirement: &id013 !ruby/object:Gem::Requirement
214
+ requirement: &id014 !ruby/object:Gem::Requirement
202
215
  none: false
203
216
  requirements:
204
217
  - - ">="
@@ -208,11 +221,11 @@ dependencies:
208
221
  - 0
209
222
  version: "0"
210
223
  type: :development
211
- version_requirements: *id013
224
+ version_requirements: *id014
212
225
  - !ruby/object:Gem::Dependency
213
226
  name: rake
214
227
  prerelease: false
215
- requirement: &id014 !ruby/object:Gem::Requirement
228
+ requirement: &id015 !ruby/object:Gem::Requirement
216
229
  none: false
217
230
  requirements:
218
231
  - - ">="
@@ -222,7 +235,7 @@ dependencies:
222
235
  - 0
223
236
  version: "0"
224
237
  type: :development
225
- version_requirements: *id014
238
+ version_requirements: *id015
226
239
  description: some stuff
227
240
  email:
228
241
  - armintor@gmail.com
@@ -238,7 +251,6 @@ files:
238
251
  - lib/devise_wind/engine.rb
239
252
  - lib/devise_wind/mixins/urls.rb
240
253
  - lib/devise_wind/model.rb
241
- - lib/devise_wind/schema.rb
242
254
  - lib/devise_wind/strategy.rb
243
255
  - lib/devise_wind/version.rb
244
256
  - lib/devise_wind.rb
@@ -1,5 +0,0 @@
1
- Devise::Schema.class_eval do
2
- def wind_authenticatable
3
- # do some stuff
4
- end
5
- end