omniauth-campus 8.1 → 8.2

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: f7535266f6d61b2ff5f49d9608604a7f208aedef
4
- data.tar.gz: 6031b936cc8b61c508b9218c3b7b62109ac89e34
3
+ metadata.gz: fb0354acf5eecfcd3dabb3ae09105085d0c15dfe
4
+ data.tar.gz: 9e6e17f9ad79cb602eac5aa726b0d64d4ecec0ab
5
5
  SHA512:
6
- metadata.gz: ec8ec95a219e35e68b3b8dfb804e700daa716bbacea766a0c900473737749f3beede674e245da9ac2c8885fbc1dc01e409fe2929717554a405cc582aeef79fb0
7
- data.tar.gz: 7722d28de687f7d214a336f1879fe3430f0b5793c3e913e5404a714a3e5fbe39402a4d98a3a479135b850b78b0e3c8c54b41708baeeb6fda38094cf7cd0a7d07
6
+ metadata.gz: 2be70ab32188a2129d1746c549936fd5b4a1ae31f102137d25f8850a9ec13d82a718b60e3d575e691e88a8032f100c9df8b2cc060b99d3beb71b062f9d36143d
7
+ data.tar.gz: 2e7793472eab1bcb522e39b136ccf340133eefa410beeaef31a3721d9723e77b9a987248e7ab988e7e8045c9600136e1e91d7fb816c583c819e32f4381bc94b6
@@ -1,6 +1,6 @@
1
1
  module Omniauth
2
2
  module Campus
3
- VERSION = "8.1"
3
+ VERSION = "8.2"
4
4
  end
5
5
  end
6
6
 
@@ -1,29 +1,41 @@
1
- require 'omniauth-oauth'
2
- require 'multi_json'
3
1
 
4
2
  module OmniAuth
5
3
  module Strategies
6
- class Campus < OmniAuth::Strategies::OAuth
7
- option :name, :campus
4
+ class Password
5
+ include OmniAuth::Strategy
8
6
 
9
- option :client_options, {
10
- :site => "http://community3dev.devcloud.acquia-sites.com/api"
11
- }
7
+ option :user_model, nil # default set to 'User' below
8
+ option :login_field, :email
12
9
 
13
- uid do
14
- raw_info[0]['uid']
10
+ def request_phase
11
+ redirect "/session/new"
15
12
  end
16
13
 
17
- info do
18
- {
19
- :name => raw_info[0]['users_name'],
20
- :email => raw_info[0]['users_mail']
21
- }
14
+ def callback_phase
15
+ return fail!(:invalid_credentials) unless user.try(:authenticate, password)
16
+ super
22
17
  end
23
18
 
24
- def raw_info
25
- @raw_info ||= MultiJson.decode(access_token.get("http://community3dev.devcloud.acquia-sites.com/api").body)
19
+ def user
20
+ @user ||= user_model.send("find_by_#{options[:login_field]}", login)
26
21
  end
27
- end
22
+
23
+ def user_model
24
+ options[:user_model] || ::User
25
+ end
26
+
27
+ def login
28
+ request[:sessions][options[:login_field].to_s]
29
+ end
30
+
31
+ def password
32
+ request[:sessions]['password']
33
+ end
34
+
35
+ uid do
36
+ user.password_digest
37
+ end
38
+
39
+ end
28
40
  end
29
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-campus
3
3
  version: !ruby/object:Gem::Version
4
- version: '8.1'
4
+ version: '8.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - johnvehr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-22 00:00:00.000000000 Z
11
+ date: 2014-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler