ffcrm_google_oauth2 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8f6535bec1dd94538e84d3860f1a41b29eebd131
4
+ data.tar.gz: 644b0292353154f479a36f98a03afdbca894bc61
5
+ SHA512:
6
+ metadata.gz: c2742b93dd8cbb176446e007e6315ad9b5162de8a847a92b04249bf1e45f668a1da9c346883141f8916c4bade37f561514beb0a9afe7983364a0ef0adfbe0f05
7
+ data.tar.gz: e397e2281dbff7e94ecb038e7333e5c048f8aff08285170f48cc54a3a8d6e417aef70747bad6098c038522097770a0d242818e44258c5f141df122e3c5117176
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2015 DmitriySalko
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,26 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'FfcrmGoogleOauth2'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
@@ -0,0 +1,21 @@
1
+ .standalone#standalone
2
+ -# The following form gets submitted to #create when @authentication is nil,
3
+ -# or to #update when @authentication is not nil (ex. suspended).
4
+ = form_for @authentication, :url => authentication_path, :html => one_submit_only do |f|
5
+ - if can_signup?
6
+ .title_tools #{t :no_account} #{link_to t(:sign_up_now), signup_path}
7
+ .title= t(:login)
8
+ .section
9
+ .label= t(:username) + ':'
10
+ = f.text_field :username
11
+ .label= t(:password) + ':'
12
+ = f.password_field :password
13
+
14
+ %div(style="margin-left:12px") #{f.check_box(:remember_me)} #{t :remember_me}
15
+ %br
16
+ .buttonbar
17
+ = f.submit t(:login)
18
+ #{t :or}
19
+ = link_to t(:forgot_password) << '?', new_password_path
20
+ %div(style="margin:24px 12px 0 12px;text-align: center;")
21
+ = link_to (image_tag("google-signin-button.png",style: "width:246px;background-color: transparent;")), "/auth/google_oauth2/", style: "background-color:transparent! important;"
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ get '/auth/:provider/callback', to: 'authentications#callback'
3
+ end
@@ -0,0 +1,19 @@
1
+ AuthenticationsController.class_eval do
2
+ def callback
3
+ auth_hash = request.env["omniauth.auth"]
4
+ email = auth_hash[:info][:email]
5
+ user = User.where("email ILIKE ?",email).first
6
+ if user
7
+ unless user.suspended?
8
+ Authentication.create(user,true) # true - remember me
9
+ redirect_to root_path, notice: "Welcome back #{user.name}"
10
+ else
11
+ flash[:warning] = "Account with email #{email} is suspended."
12
+ redirect_to login_path
13
+ end
14
+ else
15
+ flash[:warning] = "User with email #{email} not found. Unable to login."
16
+ redirect_to login_path
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ module FfcrmGoogleOauth2
2
+ class Engine < ::Rails::Engine
3
+ #isolate_namespace FfcrmGoogleOauth2
4
+ config.to_prepare do
5
+ require 'ffcrm_google_oauth2/controllers'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ module FfcrmGoogleOauth2
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "ffcrm_google_oauth2/engine"
2
+
3
+ module FfcrmGoogleOauth2
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :ffcrm_google_oauth2 do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ffcrm_google_oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - DmitriySalko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fat_free_crm
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: omniauth-google-oauth2
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pg
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Adds login using google button to login screen
70
+ email:
71
+ - dm.salko@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - MIT-LICENSE
77
+ - Rakefile
78
+ - app/assets/images/google-signin-button.png
79
+ - app/views/authentications/new.html.haml
80
+ - config/routes.rb
81
+ - lib/ffcrm_google_oauth2.rb
82
+ - lib/ffcrm_google_oauth2/controllers.rb
83
+ - lib/ffcrm_google_oauth2/engine.rb
84
+ - lib/ffcrm_google_oauth2/version.rb
85
+ - lib/tasks/ffcrm_google_oauth2_tasks.rake
86
+ homepage: https://github.com/DmitriySalko
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.2.0
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Allow users to login using their Google accounts
110
+ test_files: []