foyer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +9 -1
- data/lib/foyer/omniauth_callbacks_controller.rb +8 -0
- data/lib/foyer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af5cb236dc4e724cfcc0e93c0b595257dbd3209d
|
4
|
+
data.tar.gz: 14bf2bfdc8a8c2a7cc0f3fc3f7024a3d312b2da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c40bfe2653f1a3d675be903bb880ddae30d1cd3bd707c0f6c101c294ddaeac2d1e26a4106de5c7690a303e2cc11e689e4bf4347f0a2267a6a2892f427e8fdaee
|
7
|
+
data.tar.gz: 304fcf02a5b52432cd7bd9b64273586e1570f9b1c01f94f69031c87e8dc087ea573e1188b25f6a828089fd45a244e6d98f8e356918774e4fcf84783c11204b5a
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,8 @@ implementating controller action that will call the `sign_in` method:
|
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
Rails.application.routes.draw do
|
17
|
-
|
17
|
+
match '/auth/:provider/callback', to: 'omniauth_callbacks#callback', via: [:get, :post]
|
18
|
+
match '/auth/failure', to: 'omniauth_callbacks#failure', via: :get
|
18
19
|
end
|
19
20
|
```
|
20
21
|
|
@@ -27,6 +28,9 @@ Then in your ApplicationController:
|
|
27
28
|
class ApplicationController < ActionController::Base
|
28
29
|
include Foyer::Controller::Helpers
|
29
30
|
|
31
|
+
# Require authentication for all routes.
|
32
|
+
before_action authenticate_user!
|
33
|
+
|
30
34
|
set_user_finder do |user_id|
|
31
35
|
# Code for retrieving a user from your database here
|
32
36
|
# e.g.:
|
@@ -117,6 +121,10 @@ You can inherit from it in your application.
|
|
117
121
|
Example:
|
118
122
|
```ruby
|
119
123
|
class OmniauthCallbacksController < Foyer::OmniauthCallbacksController
|
124
|
+
def failure
|
125
|
+
redirect_to root_path, notice: 'Authentication failed!'
|
126
|
+
end
|
127
|
+
|
120
128
|
def callback
|
121
129
|
user = User.find_or_initialize_by(uid: auth_hash.uid.to_s) do |u|
|
122
130
|
u.email = auth_hash.info.email
|
data/lib/foyer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foyer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Nochlin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.2.
|
167
|
+
rubygems_version: 2.2.5
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: Authentication layer for OmniAuth
|