contour 2.7.0 → 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -29
- data/app/assets/stylesheets/glyphicon-overrides.scss +13 -0
- data/app/assets/stylesheets/opensans.scss +20 -0
- data/app/controllers/contour/registrations_controller.rb +1 -10
- data/app/controllers/contour/sessions_controller.rb +8 -41
- data/app/views/contour/layouts/_menu.html.erb +0 -2
- data/app/views/contour/sessions/new.html.erb +32 -46
- data/config/routes.rb +0 -5
- data/contour.gemspec +0 -3
- data/lib/contour.rb +2 -14
- data/lib/contour/fixes.rb +0 -3
- data/lib/contour/version.rb +3 -3
- data/lib/generators/contour/install/install_generator.rb +0 -4
- data/lib/generators/contour/install/templates/README +0 -4
- data/lib/generators/contour/install/templates/contour.rb +2 -12
- data/test/controllers/passwords_controller_test.rb +0 -9
- data/test/controllers/registrations_controller_test.rb +0 -14
- data/test/controllers/sessions_controller_test.rb +0 -12
- data/test/dummy/app/models/user.rb +0 -3
- data/test/dummy/config/initializers/contour.rb +2 -12
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20111203203123_devise_create_users.rb +1 -1
- data/test/dummy/db/schema.rb +4 -12
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/test/fixtures/users.yml +1 -1
- data/test/models/user_test.rb +0 -4
- metadata +5 -71
- data/app/assets/stylesheets/glyphicon-overrides.scss.erb +0 -13
- data/app/assets/stylesheets/opensans.css.erb +0 -20
- data/app/controllers/contour/authentications_controller.rb +0 -57
- data/app/models/authentication.rb +0 -4
- data/app/models/concerns/contour_authenticatable.rb +0 -12
- data/app/models/concerns/contourable.rb +0 -19
- data/app/views/contour/authentications/_add_remove_table.html.erb +0 -31
- data/app/views/contour/authentications/_authentications.html.erb +0 -3
- data/app/views/contour/authentications/_menu.html.erb +0 -10
- data/app/views/contour/authentications/destroy.js.erb +0 -1
- data/app/views/contour/authentications/index.html.erb +0 -6
- data/app/views/contour/layouts/_latest_news.html.erb +0 -17
- data/lib/contour/fixes/devise-with-rails-4-2.rb +0 -17
- data/lib/contour/fixes/omniauth.rb +0 -110
- data/lib/contour/fixes/sass-rails.rb +0 -8
- data/lib/generators/contour/install/templates/omniauth.rb +0 -33
- data/test/controllers/authentications_controller_test.rb +0 -57
- data/test/dummy/config/initializers/omniauth.rb +0 -33
- data/test/dummy/db/migrate/20111203203307_create_authentications.rb +0 -11
- data/test/dummy/test/fixtures/authentications.yml +0 -16
- data/test/models/authentication_test.rb +0 -11
@@ -21,18 +21,6 @@ class Contour::SessionsControllerTest < ActionController::TestCase
|
|
21
21
|
assert_response :success
|
22
22
|
end
|
23
23
|
|
24
|
-
test "should do a graceful redirect to ldap with primary email" do
|
25
|
-
post :create, user: { email: users(:valid).email, password: '' }
|
26
|
-
|
27
|
-
assert_redirected_to '/auth/ldap'
|
28
|
-
end
|
29
|
-
|
30
|
-
test "should do a graceful redirect to google_apps through secondary email" do
|
31
|
-
post :create, user: { email: 'test@gmail.com', password: '' }
|
32
|
-
|
33
|
-
assert_redirected_to '/auth/google_apps'
|
34
|
-
end
|
35
|
-
|
36
24
|
test "should not login invalid credentials" do
|
37
25
|
post :create, user: { email: '', password: '' }
|
38
26
|
|
@@ -7,9 +7,6 @@ class User < ActiveRecord::Base
|
|
7
7
|
devise :database_authenticatable, :registerable, :timeoutable,
|
8
8
|
:recoverable, :rememberable, :trackable, :validatable
|
9
9
|
|
10
|
-
# Concerns
|
11
|
-
include Contourable
|
12
|
-
|
13
10
|
# # Setup accessible (or protected) attributes for your model
|
14
11
|
# attr_accessible :email, :password, :password_confirmation, :remember_me, :first_name, :last_name
|
15
12
|
|
@@ -21,15 +21,11 @@ Contour.setup do |config|
|
|
21
21
|
# [
|
22
22
|
# {
|
23
23
|
# name: 'Login', display: 'not_signed_in', path: 'new_user_session_path', position: 'right', condition: 'true',
|
24
|
-
# links: [{ name: 'Sign Up', path: 'new_user_registration_path' }
|
25
|
-
# { divider: true },
|
26
|
-
# { authentications: true }]
|
24
|
+
# links: [{ name: 'Sign Up', path: 'new_user_registration_path' }]
|
27
25
|
# },
|
28
26
|
# {
|
29
27
|
# name: 'current_user.email', eval: true, display: 'signed_in', position: 'right', condition: 'true',
|
30
|
-
# links: [{ name: '
|
31
|
-
# { divider: true },
|
32
|
-
# { name: 'Logout', path: 'destroy_user_session_path' }]
|
28
|
+
# links: [{ name: 'Logout', path: 'destroy_user_session_path' }]
|
33
29
|
# },
|
34
30
|
# {
|
35
31
|
# name: 'Home', display: 'always', path: 'root_path', position: 'left', condition: 'true', image: '', image_options: {},
|
@@ -46,12 +42,6 @@ Contour.setup do |config|
|
|
46
42
|
# position: 'left'
|
47
43
|
# }
|
48
44
|
|
49
|
-
# Enter an address of a valid RSS Feed if you would like to see news on the sign in page.
|
50
|
-
# config.news_feed = ''
|
51
|
-
|
52
|
-
# Enter the max number of items you want to see in the news feed.
|
53
|
-
# config.news_feed_items = 5
|
54
|
-
|
55
45
|
# The following three parameters can be set as strings, which will rotate through the colors on a daily basis, selecting an index using (YearDay % ArraySize)
|
56
46
|
|
57
47
|
# A string or array of strings that represent a CSS color code for generic link color
|
Binary file
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,17 +11,9 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20111203203123) do
|
15
15
|
|
16
|
-
create_table "
|
17
|
-
t.integer "user_id"
|
18
|
-
t.string "provider"
|
19
|
-
t.string "uid"
|
20
|
-
t.datetime "created_at"
|
21
|
-
t.datetime "updated_at"
|
22
|
-
end
|
23
|
-
|
24
|
-
create_table "users", force: true do |t|
|
16
|
+
create_table "users", force: :cascade do |t|
|
25
17
|
t.string "first_name"
|
26
18
|
t.string "last_name"
|
27
19
|
t.string "status", default: "pending", null: false
|
@@ -36,8 +28,8 @@ ActiveRecord::Schema.define(version: 20111203203307) do
|
|
36
28
|
t.datetime "last_sign_in_at"
|
37
29
|
t.string "current_sign_in_ip"
|
38
30
|
t.string "last_sign_in_ip"
|
39
|
-
t.datetime "created_at"
|
40
|
-
t.datetime "updated_at"
|
31
|
+
t.datetime "created_at", null: false
|
32
|
+
t.datetime "updated_at", null: false
|
41
33
|
end
|
42
34
|
|
43
35
|
add_index "users", ["email"], name: "index_users_on_email", unique: true
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
data/test/models/user_test.rb
CHANGED
@@ -6,8 +6,4 @@ class UserTest < ActiveSupport::TestCase
|
|
6
6
|
test "should get reverse name" do
|
7
7
|
assert_equal 'LastName, FirstName', users(:valid).reverse_name
|
8
8
|
end
|
9
|
-
|
10
|
-
test "should apply omniauth" do
|
11
|
-
assert_not_nil users(:valid).apply_omniauth({'info' => {'email' => 'Email', 'first_name' => 'FirstName', 'last_name' => 'LastName'}})
|
12
|
-
end
|
13
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Remo Mueller
|
@@ -66,48 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.4.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: omniauth
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.2.1
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.2.1
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: omniauth-ldap
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 1.0.4
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 1.0.4
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: omniauth-openid
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0.1
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0.1
|
111
69
|
- !ruby/object:Gem::Dependency
|
112
70
|
name: bootstrap-sass
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -232,11 +190,10 @@ files:
|
|
232
190
|
- app/assets/stylesheets/contour.scss
|
233
191
|
- app/assets/stylesheets/contour/about.scss
|
234
192
|
- app/assets/stylesheets/datepicker.scss
|
235
|
-
- app/assets/stylesheets/glyphicon-overrides.scss
|
193
|
+
- app/assets/stylesheets/glyphicon-overrides.scss
|
236
194
|
- app/assets/stylesheets/jquery-ui-1.10.0.custom.scss
|
237
|
-
- app/assets/stylesheets/opensans.
|
195
|
+
- app/assets/stylesheets/opensans.scss
|
238
196
|
- app/assets/stylesheets/typeahead.js-bootstrap.scss
|
239
|
-
- app/controllers/contour/authentications_controller.rb
|
240
197
|
- app/controllers/contour/confirmations_controller.rb
|
241
198
|
- app/controllers/contour/passwords_controller.rb
|
242
199
|
- app/controllers/contour/registrations_controller.rb
|
@@ -244,17 +201,8 @@ files:
|
|
244
201
|
- app/controllers/contour/sessions_controller.rb
|
245
202
|
- app/controllers/contour/unlocks_controller.rb
|
246
203
|
- app/helpers/contour_helper.rb
|
247
|
-
- app/models/authentication.rb
|
248
|
-
- app/models/concerns/contour_authenticatable.rb
|
249
|
-
- app/models/concerns/contourable.rb
|
250
204
|
- app/views/contour/_links.html.erb
|
251
|
-
- app/views/contour/authentications/_add_remove_table.html.erb
|
252
|
-
- app/views/contour/authentications/_authentications.html.erb
|
253
|
-
- app/views/contour/authentications/_menu.html.erb
|
254
|
-
- app/views/contour/authentications/destroy.js.erb
|
255
|
-
- app/views/contour/authentications/index.html.erb
|
256
205
|
- app/views/contour/confirmations/new.html.erb
|
257
|
-
- app/views/contour/layouts/_latest_news.html.erb
|
258
206
|
- app/views/contour/layouts/_menu.html.erb
|
259
207
|
- app/views/contour/layouts/_per_page.html.erb
|
260
208
|
- app/views/contour/layouts/application.html.erb
|
@@ -292,16 +240,12 @@ files:
|
|
292
240
|
- lib/contour.rb
|
293
241
|
- lib/contour/engine.rb
|
294
242
|
- lib/contour/fixes.rb
|
295
|
-
- lib/contour/fixes/devise-with-rails-4-2.rb
|
296
243
|
- lib/contour/fixes/devise.rb
|
297
|
-
- lib/contour/fixes/omniauth.rb
|
298
244
|
- lib/contour/fixes/rack.rb
|
299
|
-
- lib/contour/fixes/sass-rails.rb
|
300
245
|
- lib/contour/version.rb
|
301
246
|
- lib/generators/contour/install/install_generator.rb
|
302
247
|
- lib/generators/contour/install/templates/README
|
303
248
|
- lib/generators/contour/install/templates/contour.rb
|
304
|
-
- lib/generators/contour/install/templates/omniauth.rb
|
305
249
|
- lib/generators/contour/scaffold/USAGE
|
306
250
|
- lib/generators/contour/scaffold/scaffold_generator.rb
|
307
251
|
- lib/generators/contour/scaffold/templates/_form.html.erb
|
@@ -312,7 +256,6 @@ files:
|
|
312
256
|
- lib/generators/contour/scaffold/templates/new.html.erb
|
313
257
|
- lib/generators/contour/scaffold/templates/show.html.erb
|
314
258
|
- test/contour_test.rb
|
315
|
-
- test/controllers/authentications_controller_test.rb
|
316
259
|
- test/controllers/passwords_controller_test.rb
|
317
260
|
- test/controllers/registrations_controller_test.rb
|
318
261
|
- test/controllers/sessions_controller_test.rb
|
@@ -341,7 +284,6 @@ files:
|
|
341
284
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
342
285
|
- test/dummy/config/initializers/inflections.rb
|
343
286
|
- test/dummy/config/initializers/mime_types.rb
|
344
|
-
- test/dummy/config/initializers/omniauth.rb
|
345
287
|
- test/dummy/config/initializers/secret_token.rb
|
346
288
|
- test/dummy/config/initializers/session_store.rb
|
347
289
|
- test/dummy/config/initializers/wrap_parameters.rb
|
@@ -349,7 +291,6 @@ files:
|
|
349
291
|
- test/dummy/config/routes.rb
|
350
292
|
- test/dummy/db/development.sqlite3
|
351
293
|
- test/dummy/db/migrate/20111203203123_devise_create_users.rb
|
352
|
-
- test/dummy/db/migrate/20111203203307_create_authentications.rb
|
353
294
|
- test/dummy/db/schema.rb
|
354
295
|
- test/dummy/db/test.sqlite3
|
355
296
|
- test/dummy/public/404.html
|
@@ -357,11 +298,9 @@ files:
|
|
357
298
|
- test/dummy/public/500.html
|
358
299
|
- test/dummy/public/favicon.ico
|
359
300
|
- test/dummy/script/rails
|
360
|
-
- test/dummy/test/fixtures/authentications.yml
|
361
301
|
- test/dummy/test/fixtures/users.yml
|
362
302
|
- test/helpers/contour_helper_test.rb
|
363
303
|
- test/integration/navigation_test.rb
|
364
|
-
- test/models/authentication_test.rb
|
365
304
|
- test/models/user_test.rb
|
366
305
|
- test/test_helper.rb
|
367
306
|
homepage: https://github.com/remomueller
|
@@ -379,9 +318,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
379
318
|
version: '0'
|
380
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
381
320
|
requirements:
|
382
|
-
- - "
|
321
|
+
- - ">"
|
383
322
|
- !ruby/object:Gem::Version
|
384
|
-
version:
|
323
|
+
version: 1.3.1
|
385
324
|
requirements: []
|
386
325
|
rubyforge_project:
|
387
326
|
rubygems_version: 2.4.5
|
@@ -390,7 +329,6 @@ specification_version: 4
|
|
390
329
|
summary: Basic Rails framework files and assets for layout and authentication
|
391
330
|
test_files:
|
392
331
|
- test/contour_test.rb
|
393
|
-
- test/controllers/authentications_controller_test.rb
|
394
332
|
- test/controllers/passwords_controller_test.rb
|
395
333
|
- test/controllers/registrations_controller_test.rb
|
396
334
|
- test/controllers/sessions_controller_test.rb
|
@@ -417,7 +355,6 @@ test_files:
|
|
417
355
|
- test/dummy/config/initializers/filter_parameter_logging.rb
|
418
356
|
- test/dummy/config/initializers/inflections.rb
|
419
357
|
- test/dummy/config/initializers/mime_types.rb
|
420
|
-
- test/dummy/config/initializers/omniauth.rb
|
421
358
|
- test/dummy/config/initializers/secret_token.rb
|
422
359
|
- test/dummy/config/initializers/session_store.rb
|
423
360
|
- test/dummy/config/initializers/wrap_parameters.rb
|
@@ -426,7 +363,6 @@ test_files:
|
|
426
363
|
- test/dummy/config.ru
|
427
364
|
- test/dummy/db/development.sqlite3
|
428
365
|
- test/dummy/db/migrate/20111203203123_devise_create_users.rb
|
429
|
-
- test/dummy/db/migrate/20111203203307_create_authentications.rb
|
430
366
|
- test/dummy/db/schema.rb
|
431
367
|
- test/dummy/db/test.sqlite3
|
432
368
|
- test/dummy/public/404.html
|
@@ -435,10 +371,8 @@ test_files:
|
|
435
371
|
- test/dummy/public/favicon.ico
|
436
372
|
- test/dummy/Rakefile
|
437
373
|
- test/dummy/script/rails
|
438
|
-
- test/dummy/test/fixtures/authentications.yml
|
439
374
|
- test/dummy/test/fixtures/users.yml
|
440
375
|
- test/helpers/contour_helper_test.rb
|
441
376
|
- test/integration/navigation_test.rb
|
442
|
-
- test/models/authentication_test.rb
|
443
377
|
- test/models/user_test.rb
|
444
378
|
- test/test_helper.rb
|
@@ -1,13 +0,0 @@
|
|
1
|
-
@font-face {
|
2
|
-
font-family: 'Glyphicons Halflings Contour';
|
3
|
-
src:url('bootstrap/glyphicons-halflings-regular<%= asset_path('bootstrap/glyphicons-halflings-regular.eot').split('glyphicons-halflings-regular').last %>');
|
4
|
-
|
5
|
-
src:url('bootstrap/glyphicons-halflings-regular<%= asset_path('bootstrap/glyphicons-halflings-regular.eot').split('glyphicons-halflings-regular').last %>?#iefix') format('embedded-opentype'),
|
6
|
-
url('bootstrap/glyphicons-halflings-regular<%= asset_path('bootstrap/glyphicons-halflings-regular.woff').split('glyphicons-halflings-regular').last %>') format('woff'),
|
7
|
-
url('bootstrap/glyphicons-halflings-regular<%= asset_path('bootstrap/glyphicons-halflings-regular.ttf').split('glyphicons-halflings-regular').last %>') format('truetype'),
|
8
|
-
url('bootstrap/glyphicons-halflings-regular<%= asset_path('bootstrap/glyphicons-halflings-regular.svg').split('glyphicons-halflings-regular').last %>#glyphicons_halflingsregular') format('svg');
|
9
|
-
}
|
10
|
-
|
11
|
-
.glyphicon {
|
12
|
-
font-family: 'Glyphicons Halflings Contour';
|
13
|
-
}
|
@@ -1,20 +0,0 @@
|
|
1
|
-
@font-face {
|
2
|
-
font-family: 'Open Sans';
|
3
|
-
font-style: normal;
|
4
|
-
font-weight: 300;
|
5
|
-
src:url('opensans/OpenSans-Light<%= asset_path('opensans/OpenSans-Light.ttf').split('OpenSans-Light').last %>') format('truetype');
|
6
|
-
}
|
7
|
-
|
8
|
-
@font-face {
|
9
|
-
font-family: 'Open Sans';
|
10
|
-
font-style: normal;
|
11
|
-
font-weight: 400;
|
12
|
-
src:url('opensans/OpenSans-Regular<%= asset_path('opensans/OpenSans-Regular.ttf').split('OpenSans-Regular').last %>') format('truetype');
|
13
|
-
}
|
14
|
-
|
15
|
-
@font-face {
|
16
|
-
font-family: 'Open Sans';
|
17
|
-
font-style: normal;
|
18
|
-
font-weight: 700;
|
19
|
-
src:url('opensans/OpenSans-Bold<%= asset_path('opensans/OpenSans-Bold.ttf').split('OpenSans-Bold').last %>') format('truetype');
|
20
|
-
}
|
@@ -1,57 +0,0 @@
|
|
1
|
-
class Contour::AuthenticationsController < ApplicationController
|
2
|
-
skip_before_action :verify_authenticity_token, only: :create
|
3
|
-
|
4
|
-
def index
|
5
|
-
end
|
6
|
-
|
7
|
-
def passthru
|
8
|
-
render file: "#{Rails.root}/public/404", formats: [:html], status: 404, layout: false
|
9
|
-
end
|
10
|
-
|
11
|
-
def failure
|
12
|
-
redirect_to new_user_session_path, alert: params[:message].blank? ? nil : params[:message].humanize
|
13
|
-
end
|
14
|
-
|
15
|
-
def create
|
16
|
-
omniauth = request.env["omniauth.auth"]
|
17
|
-
if omniauth
|
18
|
-
omniauth['uid'] = omniauth['info']['email'] if omniauth['provider'] == 'google_apps' and omniauth['info']
|
19
|
-
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
|
20
|
-
omniauth['info']['email'] = omniauth['extra']['raw_info']['email'] if omniauth['info'] and omniauth['info']['email'].blank? and omniauth['extra'] and omniauth['extra']['raw_info']
|
21
|
-
if authentication
|
22
|
-
logger.info "Existing authentication found."
|
23
|
-
session["user_return_to"] = request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] if request.env and request.env["action_dispatch.request.unsigned_session_cookie"] and request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] and session["user_return_to"].blank?
|
24
|
-
flash[:notice] = "Signed in successfully." if authentication.user.active_for_authentication?
|
25
|
-
sign_in_and_redirect(:user, authentication.user)
|
26
|
-
elsif current_user
|
27
|
-
logger.info "Logged in user found, creating associated authentication."
|
28
|
-
current_user.authentications.create!( provider: omniauth['provider'], uid: omniauth['uid'] )
|
29
|
-
redirect_to authentications_path, notice: "Authentication successful."
|
30
|
-
else
|
31
|
-
logger.info "Creating new user with new authentication."
|
32
|
-
user = User.new(params[:user])
|
33
|
-
user.apply_omniauth(omniauth)
|
34
|
-
user.password = Devise.friendly_token[0,20] if user.password.blank?
|
35
|
-
if user.save
|
36
|
-
session["user_return_to"] = request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] if request.env and request.env["action_dispatch.request.unsigned_session_cookie"] and request.env["action_dispatch.request.unsigned_session_cookie"]["user_return_to"] and session["user_return_to"].blank?
|
37
|
-
flash[:notice] = "Signed in successfully." if user.active_for_authentication?
|
38
|
-
sign_in_and_redirect(:user, user)
|
39
|
-
else
|
40
|
-
session[:omniauth] = omniauth.except('extra')
|
41
|
-
redirect_to new_user_registration_path
|
42
|
-
end
|
43
|
-
end
|
44
|
-
else
|
45
|
-
redirect_to authentications_path, alert: 'Authentication not successful.'
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def destroy
|
50
|
-
@authentication = current_user.authentications.find(params[:id])
|
51
|
-
@authentication.destroy
|
52
|
-
respond_to do |format|
|
53
|
-
format.html { redirect_to authentications_path, notice: 'Successfully removed authentication.' }
|
54
|
-
format.js
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Contourable
|
2
|
-
extend ActiveSupport::Concern
|
3
|
-
|
4
|
-
included do
|
5
|
-
has_many :authentications
|
6
|
-
end
|
7
|
-
|
8
|
-
def apply_omniauth(omniauth)
|
9
|
-
unless omniauth['info'].blank?
|
10
|
-
self.email = omniauth['info']['email'] if email.blank?
|
11
|
-
end
|
12
|
-
self.password = Devise.friendly_token[0,20] if self.password.blank?
|
13
|
-
authentications.build( provider: omniauth['provider'], uid: omniauth['uid'] )
|
14
|
-
end
|
15
|
-
|
16
|
-
def password_required?
|
17
|
-
(authentications.empty? || !password.blank?) && super
|
18
|
-
end
|
19
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<% if current_user %>
|
2
|
-
<table class="table table-striped" style="table-layout:fixed">
|
3
|
-
<thead>
|
4
|
-
<tr>
|
5
|
-
<th></th>
|
6
|
-
<th>Provider</th>
|
7
|
-
<th>User ID</th>
|
8
|
-
<th>Actions</th>
|
9
|
-
</tr>
|
10
|
-
</thead>
|
11
|
-
|
12
|
-
<% PROVIDERS.each do |provider| %>
|
13
|
-
<% url_params = (provider == :google_apps) ? '?domain=gmail.com' : '' %>
|
14
|
-
<% provider_name = OmniAuth.config.camelizations[provider.to_s.downcase] || provider.to_s.titleize %>
|
15
|
-
<% image_name = provider.to_s.downcase %>
|
16
|
-
<% authentication = current_user.authentications.find_by_provider(provider.to_s.downcase) %>
|
17
|
-
<tr>
|
18
|
-
<td><%= image_tag "contour/#{image_name}_32.png", height: '32px' %></td>
|
19
|
-
<td><%= provider_name %></td>
|
20
|
-
<td><%= authentication.uid if authentication %></td>
|
21
|
-
<td>
|
22
|
-
<% if authentication %>
|
23
|
-
<%= link_to 'Remove', authentication, remote: true, method: :delete, class: 'btn btn-xs btn-danger-inverse', data: { confirm: 'Are you sure you want to remove this authentication option?' } %>
|
24
|
-
<% else %>
|
25
|
-
<%= link_to 'Add', "#{request.script_name}/#{OmniAuth.config.path_prefix.split('/').last.to_s}/#{provider.to_s.downcase}#{url_params}", class: 'btn btn-xs btn-default' %>
|
26
|
-
<% end %>
|
27
|
-
</td>
|
28
|
-
</tr>
|
29
|
-
<% end %>
|
30
|
-
</table>
|
31
|
-
<% end %>
|