empower 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b807143a9e1cdb1b237d42d1bec17b9f5ada939d
4
- data.tar.gz: c6ede5512544397ae4ec1c786293bb5787d86132
3
+ metadata.gz: c4c3229553d50515a185e98428ca4b3712db0369
4
+ data.tar.gz: 0184e418539e3327d2ccf79a37ff368df57da3e2
5
5
  SHA512:
6
- metadata.gz: 1a23c399a04801665b8d2843b3e8d7828ec487b6c17d494566ed157e08d3dc0bc6c51edfe89d3ef49750c813446995470104c781f554203ada81042571e3fc77
7
- data.tar.gz: d2e9c9f11d00c427a80b7c3cfe56fbfb7bacc99f37c4a7b1827a62dda785d59fba0e65df9dc278dae31e67c2b39a1706eca062d2461e4c84fed69485f5bd951e
6
+ metadata.gz: 1d711d0e818e0718e9e61946271bbdc7d9c6f7d4e8f80ff88ce5faae51570dfce3cc8d4ebdd039dd203a3e402733d9e16bef0dd4c03bccb30e2dbedae59fff86
7
+ data.tar.gz: fccf01a06fe48a48c1bd3b2c5e21a4c09396501524e74eea8d76cf8cbe201890f609983ffa282357a9c5945a63f1c231e9ef7b74826cc35f72f75b58bf3045cc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- empower (0.1.2)
4
+ empower (0.2.0)
5
5
  devise
6
6
  omniauth-facebook
7
7
  rails (~> 4.1.0)
data/README.md CHANGED
@@ -82,6 +82,17 @@ Otherwise, if you want to handle your own links, they would look like this:
82
82
  <%= link_to 'Login', user_omniauth_authorize_path(:facebook) %>
83
83
  ```
84
84
 
85
+ Overriding Redirects
86
+ ----------
87
+
88
+ When you are signed in successfully through Facebook, Empower uses Devise's
89
+ `after_sign_in_path_for` method. You can customize this method in your
90
+ application controller
91
+
92
+ [See this doc page](https://github.com/plataformatec/devise/wiki/How-To
93
+ :-redirect-to-a -specific-page-on-successful-sign-in#redirect-back-to-current-
94
+ page-after-oauth- signin) for more information.
95
+
85
96
  Contributing
86
97
  ----------
87
98
 
@@ -1,29 +1,24 @@
1
- require_dependency "empower/application_controller"
1
+ require_dependency "empower_controller"
2
2
 
3
- module Empower
4
- class OmniauthCallbacksController < ApplicationController
3
+ class Empower::OmniauthCallbacksController < EmpowerController
5
4
 
6
- def facebook
7
- @user = User.from_omniauth(request.env["omniauth.auth"])
5
+ def facebook
6
+ @user = User.from_omniauth(request.env["omniauth.auth"])
8
7
 
9
- if @user.persisted?
10
- if request.env['omniauth.origin'].split('/').last == 'login'
11
- sign_in @user #this will throw if @user is not activated
12
- redirect_to main_app.root_path
13
- else
14
- sign_in_and_redirect @user
15
- end
16
- else
17
- session["devise.facebook_data"] = request.env["omniauth.auth"]
18
- redirect_to main_app.root_path
19
- end
8
+ if @user.persisted?
9
+ sign_in @user #this will throw if @user is not activated
10
+ redirect_to after_sign_in_path_for(@user)
11
+ else
12
+ session["devise.facebook_data"] = request.env["omniauth.auth"]
13
+ redirect_to after_sign_in_path_for(@user)
20
14
  end
15
+ end
21
16
 
22
- def failure
23
- redirect_to(
24
- (session[:redirect] || main_app.root_path),
25
- :alert => "Could not authenticate your request."
26
- )
27
- end
17
+ def failure
18
+ redirect_to(
19
+ (session[:redirect] || main_app.root_path),
20
+ :alert => "Could not authenticate your request."
21
+ )
28
22
  end
23
+
29
24
  end
@@ -0,0 +1,2 @@
1
+ class EmpowerController < ApplicationController
2
+ end
@@ -1,3 +1,3 @@
1
1
  module Empower
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: empower
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean C Davis
@@ -82,8 +82,8 @@ files:
82
82
  - app/assets/images/empower/.keep
83
83
  - app/assets/javascripts/empower/application.js
84
84
  - app/assets/stylesheets/empower/application.css
85
- - app/controllers/empower/application_controller.rb
86
85
  - app/controllers/empower/omniauth_callbacks_controller.rb
86
+ - app/controllers/empower_controller.rb
87
87
  - app/helpers/empower/application_helper.rb
88
88
  - app/helpers/empower/omniauth_helper.rb
89
89
  - app/views/layouts/empower/application.html.erb
@@ -1,4 +0,0 @@
1
- module Empower
2
- class ApplicationController < ActionController::Base
3
- end
4
- end