user_mgmt 0.0.616 → 0.0.621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/app/controllers/user_mgmt/sessions_controller.rb +20 -4
- data/app/helpers/user_mgmt/application_helper.rb +0 -4
- data/app/views/user_mgmt/registrations/new.html.haml +10 -2
- data/app/views/user_mgmt/sessions/new.html.haml +1 -1
- data/lib/generators/templates/user_mgmt.rb +12 -5
- data/lib/user_mgmt.rb +0 -3
- data/lib/user_mgmt/engine.rb +10 -1
- data/lib/user_mgmt/version.rb +1 -1
- data/test/dummy/app/views/simulate/index.html.haml +0 -3
- data/test/dummy/config/initializers/user_mgmt.rb +16 -9
- data/user_mgmt.gemspec +3 -5
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 324e6866dcf4b2a821153210dd52a4811ef41c28
|
4
|
+
data.tar.gz: b4dbde104f1b03f9e2a04f86905f5d31e9c36b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba0a73a307eede6a4c5e03699d80090f4d0555214cafe7cf29c1ee60760f96812e30a32bc58a49bca7792578c8d0a952a4907bdd31f0c47e84f77ddc89d333d7
|
7
|
+
data.tar.gz: 0d98c1d696c599ca19e738de67d3cf02cc58f8811858a62e8513e8a70bcc8256493d1d87737f32e1da2f1eb7256a68c5f33dd7b8cb243a957b147d0c03f67205
|
data/README.md
CHANGED
@@ -16,11 +16,19 @@ Then you have to run the generator:
|
|
16
16
|
|
17
17
|
rails generate user_mgmt:install
|
18
18
|
|
19
|
-
This generator will install an initializer which describes all the gem's configuration options and you must take a look at it.
|
19
|
+
This generator will install an initializer which describes all the gem's configuration options and you must take a look at it.
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
-
|
23
|
+
The gem includes some views (with their respective controllers) that are gonna be used by many distinct apps.
|
24
|
+
|
25
|
+
In order to use the gem's views, you have to refer to them by:
|
26
|
+
|
27
|
+
user_mgmt.<route path>
|
28
|
+
|
29
|
+
Which can be "log_in_path", "sign_up_path" and "log_out_path" (more to be added in the future), e.g:
|
30
|
+
|
31
|
+
user_mgmt.log_in_path
|
24
32
|
|
25
33
|
## Contributing
|
26
34
|
|
@@ -25,14 +25,25 @@ module UserMgmt
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# GET 'auth/:provider/callback'
|
28
|
+
# That is the controller method that is called after getting the information from an oauth strategy
|
28
29
|
def oauth_email
|
29
30
|
|
30
31
|
@uid = env['omniauth.auth']["uid"]
|
31
32
|
@provider= env['omniauth.auth']["provider"]
|
32
|
-
|
33
|
+
|
34
|
+
if @provider == "google_oauth2"
|
35
|
+
@provider = "google"
|
36
|
+
end
|
37
|
+
|
38
|
+
if @provider == "windowslive"
|
39
|
+
@provider = "windows_live"
|
40
|
+
end
|
41
|
+
|
33
42
|
response = log_in_oauth @uid, @provider
|
34
43
|
|
35
|
-
# if user logged in succesfully, just redirect to main page
|
44
|
+
# if user logged in succesfully, just redirect to main page,
|
45
|
+
# otherwise it means the user doesn't exist yet, so continue
|
46
|
+
# normaly (user will be asked for his email).
|
36
47
|
if response[:status] == "200"
|
37
48
|
session[:user_session_id] = response[:body]["session"]
|
38
49
|
redirect_to main_app.root_path, notice: "User logged in!"
|
@@ -43,8 +54,13 @@ module UserMgmt
|
|
43
54
|
# POST '/oauth_log_in'
|
44
55
|
def create_oauth
|
45
56
|
|
46
|
-
sign_up_oauth params["uid"], params["provider"].to_sym, params["user"]["Email"]
|
47
|
-
|
57
|
+
response = sign_up_oauth params["uid"], params["provider"].to_sym, params["user"]["Email"]
|
58
|
+
|
59
|
+
#if for some reason, the user couldn't be created
|
60
|
+
if response[:status] == "400"
|
61
|
+
redirect_to sign_up_path, notice: response[:body]
|
62
|
+
end
|
63
|
+
|
48
64
|
response = log_in_oauth params["uid"], params["provider"].to_sym
|
49
65
|
|
50
66
|
session[:user_session_id] = response[:body]["session"]
|
@@ -5,6 +5,14 @@
|
|
5
5
|
= submit_tag 'submit', :class => "btn btn-large btn-primary"
|
6
6
|
%ul.unstyled
|
7
7
|
%li
|
8
|
-
= link_to "
|
8
|
+
= link_to "Log in with Facebook", "auth/facebook"
|
9
9
|
%li
|
10
|
-
= link_to "
|
10
|
+
= link_to "Log in with Twitter", "auth/twitter"
|
11
|
+
%li
|
12
|
+
= link_to "Log in with Outlook", "auth/windowslive"
|
13
|
+
%li
|
14
|
+
= link_to "Log in with LinkedIn", "auth/linkedin"
|
15
|
+
%li
|
16
|
+
= link_to "Log in with Yahoo", "auth/yahoo"
|
17
|
+
%li
|
18
|
+
= link_to "Log in with GMail", "auth/google_oauth2"
|
@@ -6,11 +6,6 @@ UserMgmt.setup do |config|
|
|
6
6
|
# authentication won't be possible to happen
|
7
7
|
config.external_database_URI = "http://localhost:3000/"
|
8
8
|
|
9
|
-
# Namespace router name. It is gonna appear in front of every route that the gem generates.
|
10
|
-
# If you change this name, you are gonna have to change it as well in your app's routes file:
|
11
|
-
# mount UserMgmt::Engine => "/new_name"
|
12
|
-
config.router_name = "user/"
|
13
|
-
|
14
9
|
end
|
15
10
|
|
16
11
|
# Edit your strategy keys:
|
@@ -21,6 +16,18 @@ ENV['TWITTER_SECRET'] = ""
|
|
21
16
|
ENV['FACEBOOK_KEY'] = ""
|
22
17
|
ENV['FACEBOOK_SECRET'] = ""
|
23
18
|
|
19
|
+
ENV['LINKEDIN_KEY'] = ""
|
20
|
+
ENV['LINKEDIN_SECRET'] = ""
|
21
|
+
|
22
|
+
ENV['WINDOWSLIVE_KEY'] = ""
|
23
|
+
ENV['WINDOWSLIVE_SECRET'] = ""
|
24
|
+
|
25
|
+
ENV['YAHOO_KEY'] = ""
|
26
|
+
ENV['YAHOO_SECRET'] = ""
|
27
|
+
|
28
|
+
ENV['GOOGLE_KEY'] = ""
|
29
|
+
ENV['GOOGLE_SECRET'] = ""
|
30
|
+
|
24
31
|
# The code below include the view helpers from user_mgmt in the main app.
|
25
32
|
# NOTE: Do not change this code.
|
26
33
|
ActiveSupport.on_load :action_controller do
|
data/lib/user_mgmt.rb
CHANGED
@@ -8,9 +8,6 @@ module UserMgmt
|
|
8
8
|
mattr_accessor :external_database_URI
|
9
9
|
@@external_database_URI = "http://localhost:3000/"
|
10
10
|
|
11
|
-
# Namespace router name. It is gonna appear in front of every route that the gem generates.
|
12
|
-
mattr_accessor :router_name
|
13
|
-
@@router_name = "user/"
|
14
11
|
|
15
12
|
# Default way to setup UserMgmt. Run rails generate user_mgmt:install to create
|
16
13
|
# a fresh initializer with all configuration values.
|
data/lib/user_mgmt/engine.rb
CHANGED
@@ -4,6 +4,11 @@ module UserMgmt
|
|
4
4
|
require 'omniauth'
|
5
5
|
require 'omniauth-facebook'
|
6
6
|
require 'omniauth-twitter'
|
7
|
+
require 'omniauth-linkedin'
|
8
|
+
require 'omniauth-windowslive'
|
9
|
+
require 'omniauth-yahoo'
|
10
|
+
require "omniauth-google-oauth2"
|
11
|
+
|
7
12
|
|
8
13
|
class Engine < ::Rails::Engine
|
9
14
|
isolate_namespace UserMgmt
|
@@ -13,7 +18,11 @@ module UserMgmt
|
|
13
18
|
# provider :developer unless Rails.env.production?
|
14
19
|
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
15
20
|
provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
|
16
|
-
|
21
|
+
provider :linkedin, ENV['LINKEDIN_KEY'], ENV['LINKEDIN_SECRET'], :scope => 'r_fullprofile r_emailaddress r_network'
|
22
|
+
provider :windowslive, ENV['WINDOWSLIVE_KEY'], ENV['WINDOWSLIVE_SECRET'], :scope => 'wl.basic'
|
23
|
+
provider :yahoo, ENV['YAHOO_KEY'], ENV['YAHOO_SECRET']
|
24
|
+
provider :google_oauth2, ENV["GOOGLE_KEY"], ENV["GOOGLE_SECRET"]
|
25
|
+
end
|
17
26
|
|
18
27
|
end
|
19
28
|
end
|
data/lib/user_mgmt/version.rb
CHANGED
@@ -6,20 +6,27 @@ UserMgmt.setup do |config|
|
|
6
6
|
# authentication won't be possible to happen
|
7
7
|
config.external_database_URI = "http://localhost:3001/"
|
8
8
|
|
9
|
-
# Namespace router name. It is gonna appear in front of every route that the gem generates.
|
10
|
-
# If you change this name, you are gonna have to change it as well in your app's routes file:
|
11
|
-
# mount UserMgmt::Engine => "/new_name"
|
12
|
-
config.router_name = "user/"
|
13
|
-
|
14
9
|
end
|
15
10
|
|
16
11
|
# Edit your strategy keys:
|
17
12
|
|
18
|
-
ENV['TWITTER_KEY'] = "
|
19
|
-
ENV['TWITTER_SECRET'] = "
|
13
|
+
ENV['TWITTER_KEY'] = "Xt05nTQGt0QFWbA8FYr1w"
|
14
|
+
ENV['TWITTER_SECRET'] = "IYmjtwCNQbDimyeahBj8vCG31gtIrZvQeUAN9X3JIc"
|
15
|
+
|
16
|
+
ENV['FACEBOOK_KEY'] = "498728433547179"
|
17
|
+
ENV['FACEBOOK_SECRET'] = "ed896033a2f8ecee03fc8be363f47fb6"
|
18
|
+
|
19
|
+
ENV['LINKEDIN_KEY'] = "bjqh7h7mnj3f"
|
20
|
+
ENV['LINKEDIN_SECRET'] = "wbmOCFf1wvT750m6"
|
21
|
+
|
22
|
+
ENV['WINDOWSLIVE_KEY'] = "000000004810271E"
|
23
|
+
ENV['WINDOWSLIVE_SECRET'] = "NE7NeuwHYF7OE1Z1huNYJjzOjWhlK7k0"
|
24
|
+
|
25
|
+
ENV['YAHOO_KEY'] = "dj0yJmk9NWRNbGFSY1o5ajh0JmQ9WVdrOU5YSmFZbGMzTjJVbWNHbzlNVE13TmpBNU1qSTJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD1hYg--"
|
26
|
+
ENV['YAHOO_SECRET'] = "56f9a0feb52885a985f01b1f13bd58fc73537096"
|
20
27
|
|
21
|
-
ENV['
|
22
|
-
ENV['
|
28
|
+
ENV['GOOGLE_KEY'] = "402445378839.apps.googleusercontent.com"
|
29
|
+
ENV['GOOGLE_SECRET'] = "HCjws5JLjaRy79uVHH4ji1kT"
|
23
30
|
|
24
31
|
# The code below include the view helpers from user_mgmt in the main app.
|
25
32
|
# NOTE: Do not change this code.
|
data/user_mgmt.gemspec
CHANGED
@@ -14,15 +14,11 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.homepage = "https://github.com/Methos2013/user_mgmt_gem"
|
15
15
|
s.license = "MIT"
|
16
16
|
|
17
|
-
# s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md","user_mgmt.gemspec"]
|
18
|
-
# s.test_files = Dir["test/**/*"]
|
19
|
-
|
20
17
|
s.files = `git ls-files`.split($/) - `git ls-files -d`.split($/)
|
21
18
|
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
22
19
|
s.test_files = s.files.grep(%r{^(test|s|features)/})
|
23
20
|
s.require_paths = ["lib"]
|
24
21
|
|
25
|
-
# s.add_dependency "rails", "~> 4.0.0"
|
26
22
|
s.add_development_dependency "sqlite3"
|
27
23
|
|
28
24
|
s.add_development_dependency "rspec"
|
@@ -31,6 +27,8 @@ Gem::Specification.new do |s|
|
|
31
27
|
s.add_development_dependency "bundler", "~> 1.3"
|
32
28
|
|
33
29
|
s.add_runtime_dependency "rails"
|
30
|
+
# For some reason that I coudn't figure out, I get an error if I dont add 'haml' as a development dependency as well as a runtime dependecy.
|
31
|
+
s.add_development_dependency "haml"
|
34
32
|
s.add_runtime_dependency "haml"
|
35
33
|
s.add_runtime_dependency "haml-rails"
|
36
34
|
s.add_runtime_dependency 'sass-rails'#, '~> 3.2'
|
@@ -41,6 +39,6 @@ Gem::Specification.new do |s|
|
|
41
39
|
s.add_runtime_dependency 'omniauth-linkedin'
|
42
40
|
s.add_runtime_dependency 'omniauth-windowslive'
|
43
41
|
s.add_runtime_dependency 'omniauth-yahoo'
|
44
|
-
s.add_runtime_dependency
|
42
|
+
s.add_runtime_dependency "omniauth-google-oauth2"
|
45
43
|
|
46
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_mgmt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.621
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danilo Faria, Fernando Gorodscy, Josh Leslie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: haml
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: haml
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,7 +249,7 @@ dependencies:
|
|
235
249
|
- !ruby/object:Gem::Version
|
236
250
|
version: '0'
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
|
-
name: omniauth-google
|
252
|
+
name: omniauth-google-oauth2
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
240
254
|
requirements:
|
241
255
|
- - '>='
|