From c2e89f8781d1b1bd8fa1556078d0d98758756be4 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 03:13:15 +0400 Subject: [PATCH 01/11] #30: use omniauth for registration through Facebook, GitHub, Google --- Gemfile | 11 ++- Gemfile.lock | 64 +++++++++------ .../users/omniauth_callbacks_controller.rb | 79 ++++++++++++++----- .../users/register_requests_controller.rb | 6 +- app/models/user.rb | 1 + app/views/devise/registrations/new.html.haml | 10 ++- config/application.yml.sample | 10 +++ config/initializers/devise.rb | 11 ++- config/initializers/omniauth.rb | 9 +++ lib/ext/preregistration.rb | 8 +- 10 files changed, 154 insertions(+), 55 deletions(-) create mode 100644 config/initializers/omniauth.rb diff --git a/Gemfile b/Gemfile index fb9224fac..4b7317e2b 100644 --- a/Gemfile +++ b/Gemfile @@ -5,10 +5,15 @@ gem 'redhillonrails_core', :git => 'git://github.com/warpc/redhillonrails_core.g gem 'pg', '~> 0.14.0' -gem 'devise', '~> 2.1.2' -gem 'omniauth', '~> 1.1.0' -gem 'omniauth-openid', '~> 1.0.1' +gem 'devise', '~> 2.2.3' +gem 'omniauth' +# gem 'oa-oauth', :require => 'omniauth/oauth' +gem 'omniauth-facebook' +gem 'omniauth-google-oauth2' +gem 'omniauth-github' +# gem 'omniauth-openid', '~> 1.0.1' gem 'cancan', '1.6.7' # 1.6.8 fail specs with strange error +# gem 'uuidtools' gem 'ancestry', '~> 1.3.0' gem 'paperclip', '~> 3.3.1' diff --git a/Gemfile.lock b/Gemfile.lock index c73f08a63..422b28923 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -52,7 +52,7 @@ GEM activesupport (3.2.13) i18n (= 0.6.1) multi_json (~> 1.0) - airbrake (3.1.8) + airbrake (3.1.9) activesupport builder json @@ -68,8 +68,8 @@ GEM daemons (~> 1.1.4) i18n (>= 0.5.0) state_machine (~> 1.1.0) - bourne (1.2.1) - mocha (= 0.12.7) + bourne (1.4.0) + mocha (~> 0.13.2) builder (3.0.4) cancan (1.6.7) cape (1.7.0) @@ -80,7 +80,7 @@ GEM net-ssh (>= 2.0.14) net-ssh-gateway (>= 1.1.0) capistrano_colors (0.5.5) - charlock_holmes (0.6.9.1) + charlock_holmes (0.6.9.2) chronic (0.6.7) chunky_png (1.2.7) cocaine (0.4.2) @@ -90,7 +90,7 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.6.1) + coffee-script-source (1.6.2) compass (0.12.2) chunky_png (~> 1.2) fssm (>= 0.2.7) @@ -99,7 +99,7 @@ GEM compass (>= 0.12.2, < 0.14) creole (0.5.0) daemons (1.1.9) - devise (2.1.3) + devise (2.2.3) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) @@ -119,6 +119,8 @@ GEM factory_girl_rails (4.0.0) factory_girl (~> 4.0.0) railties (>= 3.0.0) + faraday (0.8.7) + multipart-post (~> 1.1) ffi (1.0.11) fssm (0.2.10) github-linguist (2.2.1) @@ -147,9 +149,10 @@ GEM haml (~> 3.1) railties (>= 3.1, < 4.1) hashie (1.2.0) - highline (1.6.16) + highline (1.6.15) hike (1.2.1) hirb (0.7.1) + httpauth (0.2.0) i18n (0.6.1) jbuilder (0.8.3) activesupport (>= 3.0.0) @@ -158,6 +161,8 @@ GEM railties (>= 3.1.0, < 5.0) thor (~> 0.14) json (1.7.7) + jwt (0.1.8) + multi_json (>= 1.5) kgio (2.8.0) libv8 (3.3.10.4) macaddr (1.6.1) @@ -179,10 +184,11 @@ GEM actionpack metaclass (0.0.1) mime-types (1.21) - mocha (0.12.7) + mocha (0.13.3) metaclass (~> 0.0.1) mock_redis (0.6.2) - multi_json (1.7.1) + multi_json (1.7.2) + multipart-post (1.2.0) mustache (0.99.4) net-scp (1.1.0) net-ssh (>= 2.6.5) @@ -192,13 +198,27 @@ GEM net-ssh-gateway (1.2.0) net-ssh (>= 2.6.5) newrelic_rpm (3.5.5.38) - nokogiri (1.5.7) + nokogiri (1.5.9) + oauth2 (0.8.1) + faraday (~> 0.8) + httpauth (~> 0.1) + jwt (~> 0.1.4) + multi_json (~> 1.0) + rack (~> 1.2) omniauth (1.1.3) hashie (~> 1.2) rack - omniauth-openid (1.0.1) + omniauth-facebook (1.4.1) + omniauth-oauth2 (~> 1.1.0) + omniauth-github (1.1.0) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.1) + omniauth-google-oauth2 (0.1.13) + omniauth (~> 1.0) + omniauth-oauth2 + omniauth-oauth2 (1.1.1) + oauth2 (~> 0.8.0) omniauth (~> 1.0) - rack-openid (~> 1.3.1) orm_adapter (0.4.0) paperclip (3.3.1) activemodel (>= 3.0.0) @@ -218,9 +238,6 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-openid (1.3.1) - rack (>= 1.1.0) - ruby-openid (>= 2.1.8) rack-protection (1.5.0) rack rack-ssl (1.3.3) @@ -253,7 +270,7 @@ GEM rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) raindrops (0.10.0) - rake (10.0.3) + rake (10.0.4) rdiscount (2.0.7.1) rdoc (3.12.2) json (~> 1.4) @@ -294,7 +311,6 @@ GEM ruby-haml-js (0.0.3) execjs sprockets (>= 2.0.0) - ruby-openid (2.2.3) rubypython (0.5.3) blankslate (>= 2.1.2.3) ffi (~> 1.0.7) @@ -315,9 +331,9 @@ GEM shoulda-context (~> 1.0, >= 1.0.1) shoulda-matchers (~> 1.0, >= 1.4.1) shoulda-context (1.0.2) - shoulda-matchers (1.5.0) + shoulda-matchers (1.5.4) activesupport (>= 3.0.0) - bourne (~> 1.2.0) + bourne (~> 1.3) sinatra (1.3.6) rack (~> 1.4) rack-protection (~> 1.3) @@ -341,7 +357,7 @@ GEM eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.17.0) - tilt (1.3.5) + tilt (1.3.6) treetop (1.4.12) polyglot polyglot (>= 0.3.1) @@ -388,7 +404,7 @@ DEPENDENCIES coffee-rails (~> 3.2.2) compass-rails (~> 1.0.3) creole - devise (~> 2.1.2) + devise (~> 2.2.3) diff-display (~> 0.0.1) factory_girl_rails (~> 4.0.0) github-linguist (~> 2.2.1) @@ -404,8 +420,10 @@ DEPENDENCIES meta-tags (~> 1.2.5) mock_redis (= 0.6.2) newrelic_rpm (~> 3.5.5.38) - omniauth (~> 1.1.0) - omniauth-openid (~> 1.0.1) + omniauth + omniauth-facebook + omniauth-github + omniauth-google-oauth2 paperclip (~> 3.3.1) perform_later (~> 1.3.0) pg (~> 0.14.0) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index a23a8c7e1..35277c82d 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,30 +1,69 @@ # -*- encoding : utf-8 -*- class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController - def open_id - # raise env['omniauth.auth'].inspect - generic + require 'uuidtools' + + # def facebook + # generic + # end + + def facebook + oauthorize 'Facebook' + end + + def google_oauth2 + oauthorize 'google_oauth2' + end + + def github + oauthorize 'GitHub' end def passthru render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false end + + private - protected - - def generic - authentication = Authentication.find_or_initialize_by_provider_and_uid(env['omniauth.auth']['provider'], env['omniauth.auth']['uid']) - if authentication.new_record? - if user_signed_in? # New authentication method for current_user - authentication.user = current_user - authentication.save - else # Register new user from session - session["devise.omniauth_data"] = env["omniauth.auth"].except('extra') - flash[:notice] = I18n.t "devise.omniauth_callbacks.register" - redirect_to new_user_registration_url - end - else + def oauthorize(kind) + provider = kind.downcase + @user = find_for_ouath(env["omniauth.auth"], current_user) + if @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => action_name.classify - sign_in_and_redirect authentication.user, :event => :authentication - end + sign_in_and_redirect @user, :event => :authentication + else + session["devise.#{provider}_data"] = env["omniauth.auth"] + redirect_to new_user_registration_url + end end -end + + def find_for_ouath(auth, resource=nil) + provider, uid = auth['provider'], auth['uid'] + authentication = Authentication.find_or_initialize_by_provider_and_uid(provider, uid) + if authentication.new_record? + unless user_signed_in? # Register new user from session + case provider + when 'facebook' + name = auth['extra']['raw_info']['name'] + email = auth['info']['email'] + when 'google_oauth2' + name = auth['info']['nickname'] + email = auth['info']['email'] + when 'github' + + else + raise 'Provider #{provider} not handled' + end + user = User.create( + :uname => "#{provider}-#{uid}", + :name => name, + :email => email, + :password => Devise.friendly_token[0,20] + ) + end + authentication.user = current_user + authentication.save + end + return user + end + +end \ No newline at end of file diff --git a/app/controllers/users/register_requests_controller.rb b/app/controllers/users/register_requests_controller.rb index a21249cdb..e541f7476 100644 --- a/app/controllers/users/register_requests_controller.rb +++ b/app/controllers/users/register_requests_controller.rb @@ -4,7 +4,11 @@ class Users::RegisterRequestsController < ApplicationController layout 'invite' def new - render :invite + if APP_CONFIG['preregistration'] + render :invite + else + redirect_to new_user_registration_path + end end def create diff --git a/app/models/user.rb b/app/models/user.rb index 953665770..fce41e6b6 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -7,6 +7,7 @@ class User < Avatar devise :database_authenticatable, :registerable, :omniauthable, :token_authenticatable,# :encryptable, :timeoutable :recoverable, :rememberable, :validatable, :lockable, :confirmable#, :reconfirmable, :trackable + devise :omniauthable, :omniauth_providers => [:facebook, :google_oauth2, :github] has_one :notifier, :class_name => 'SettingsNotifier', :dependent => :destroy #:notifier diff --git a/app/views/devise/registrations/new.html.haml b/app/views/devise/registrations/new.html.haml index 5fb9371d6..4d1c06b22 100644 --- a/app/views/devise/registrations/new.html.haml +++ b/app/views/devise/registrations/new.html.haml @@ -17,7 +17,10 @@ .both .left=t('activerecord.attributes.user.email') .right - = f.text_field :email, :id => 'email', :readonly => 'readonly', :class => "registartion-input #{email_error ? 'registartion-input-error' : ''}" + - if APP_CONFIG['preregistration'] + = f.text_field :email, :id => 'email', :readonly => 'readonly', :class => "registartion-input #{email_error ? 'registartion-input-error' : ''}" + - else + = f.text_field :email, :id => 'email', :class => 'registartion-input' .both .left=t('activerecord.attributes.user.password') .right @@ -31,6 +34,11 @@ =f.submit t("layout.devise.shared_links.sign_up"), :class => 'button', :id => 'btnLogin' .both + - if devise_mapping.omniauthable? + - resource_class.omniauth_providers.each do |provider| + = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) + %br + =showDeviseHintError(:login, uname_error) =showDeviseHintError(:name, name_error) =showDeviseHintError(:email, email_error) diff --git a/config/application.yml.sample b/config/application.yml.sample index 07a3e369a..abf353069 100644 --- a/config/application.yml.sample +++ b/config/application.yml.sample @@ -2,6 +2,7 @@ common: &common project_name: ABF repo_project_name: ABF anonymous_access: true + preregistration: false file_store_url: 'http://file-store.rosalinux.ru' distr_types: ['mdv', 'rhel', 'nau5'] abf_worker: @@ -11,6 +12,15 @@ common: &common airbrake_api_key: 'airbrake_api_key' devise_pepper: 'devise_pepper' secret_token: 'secret_token' + github: + id: 'APP_ID' + secret: 'APP_SECRET' + google: + id: 'APP_ID' + secret: 'APP_SECRET' + facebook: + id: 'APP_ID' + secret: 'APP_SECRET' wiki_formats: markdown: "Markdown" diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 6f9f45858..be74b0c29 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -182,14 +182,19 @@ Devise.setup do |config| # config.navigational_formats = [:"*/*", "*/*", :html] # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :delete + config.sign_out_via = :get # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' - require 'openid/store/filesystem' - config.omniauth :openid, :name => 'open_id' #, :store => OpenID::Store::Filesystem.new('./tmp') + + # require 'openid/store/filesystem' + # config.omniauth :openid, :name => 'open_id' #, :store => OpenID::Store::Filesystem.new('./tmp') + + config.omniauth :facebook, APP_CONFIG['keys']['facebook']['id'], APP_CONFIG['keys']['facebook']['secret'] + config.omniauth :google_oauth2, APP_CONFIG['keys']['google']['id'], APP_CONFIG['keys']['google']['secret'], {:access_type => 'offline', :approval_prompt => ''} + config.omniauth :github, APP_CONFIG['keys']['github']['id'], APP_CONFIG['keys']['github']['secret'] # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb new file mode 100644 index 000000000..ac5e72a76 --- /dev/null +++ b/config/initializers/omniauth.rb @@ -0,0 +1,9 @@ +# require "omniauth-facebook" + +# Rails.application.config.middleware.use OmniAuth::Builder do +# [:facebook, :github, :google_oauth2].each do |kind| +# provider kind, APP_CONFIG['keys']["#{kind}"]['id'], APP_CONFIG['keys']["#{kind}"]['secret'] +# end +# end + +OmniAuth.config.logger = Rails.logger \ No newline at end of file diff --git a/lib/ext/preregistration.rb b/lib/ext/preregistration.rb index 5b07c5d88..77b5ee919 100644 --- a/lib/ext/preregistration.rb +++ b/lib/ext/preregistration.rb @@ -51,10 +51,10 @@ module Preregistration end end - end #RegistrationsController - end #Devise -end #Preregistration + end # RegistrationsController + end # Devise +end # Preregistration Rails.application.config.to_prepare do - ::Devise::RegistrationsController.send :include, Preregistration::Devise::RegistrationsController + ::Devise::RegistrationsController.send :include, Preregistration::Devise::RegistrationsController if APP_CONFIG['preregistration'] end From e74e6609732e71eebf870f76e4f0319b404da1ca Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 15:52:38 +0400 Subject: [PATCH 02/11] #30: update UI for sign_in and sign_up --- app/assets/images/{gplus.png => facebook.png} | Bin app/assets/images/{git.png => github.png} | Bin app/assets/images/google.png | Bin 0 -> 3077 bytes app/assets/stylesheets/login.scss | 12 +++++++++- app/assets/stylesheets/reg_session.scss | 22 ++++++++++++++++++ app/views/devise/registrations/new.html.haml | 6 +---- app/views/devise/sessions/new.html.haml | 3 +-- app/views/devise/shared/_providers.haml | 11 +++++++++ config/locales/en.yml | 1 + config/locales/ru.yml | 1 + 10 files changed, 48 insertions(+), 8 deletions(-) rename app/assets/images/{gplus.png => facebook.png} (100%) rename app/assets/images/{git.png => github.png} (100%) create mode 100644 app/assets/images/google.png create mode 100644 app/views/devise/shared/_providers.haml diff --git a/app/assets/images/gplus.png b/app/assets/images/facebook.png similarity index 100% rename from app/assets/images/gplus.png rename to app/assets/images/facebook.png diff --git a/app/assets/images/git.png b/app/assets/images/github.png similarity index 100% rename from app/assets/images/git.png rename to app/assets/images/github.png diff --git a/app/assets/images/google.png b/app/assets/images/google.png new file mode 100644 index 0000000000000000000000000000000000000000..80f6155e073f4e9f879516c8b615dd5b3223933c GIT binary patch literal 3077 zcmV+g4EpnlP)X1^@s6z#LUx00009a7bBm000XU z000XU0RWnu7ytkYPiaF#P*7-ZbZ>KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S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ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0003nNkliZODlvEqi~?}FVe4e)-w>gfw`299ZAUDscOsQ?Bz z0NW9)4zML|)&LIh>ZC@1Uj@X@N<)nCll39chp_KMi1I|)TOYzn%@49KXRVIAnz$Lj zCF9$u_a~qdvzhs~*ysnKIbSjAKTFWPn2{Pb;+s9HT)P^u(W%=dvSg{f6f6Nfj-_r6 z*c3swOKLO+%u8(y5C`T)i1TAn?|@bWd{*m8*baCoK@bC+L?>P5J12nm>$>(!)0k>y zCp1{3W 'button', :id => 'btnLogin' .both - - - if devise_mapping.omniauthable? - - resource_class.omniauth_providers.each do |provider| - = link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) - %br + = render 'devise/shared/providers' =showDeviseHintError(:login, uname_error) =showDeviseHintError(:name, name_error) diff --git a/app/views/devise/sessions/new.html.haml b/app/views/devise/sessions/new.html.haml index 55c16f02d..1598f8dcf 100644 --- a/app/views/devise/sessions/new.html.haml +++ b/app/views/devise/sessions/new.html.haml @@ -27,8 +27,7 @@ .text=t('devise.sessions.remember_me') .in=f.submit t('layout.devise.shared_links.sign_in'), :class => 'button', :id => 'btnLogin' %div{:style => "clear: both;"} - .hr - .both + = render 'devise/shared/providers' .forgot .password %p= link_to t("layout.devise.shared_links.forgot_password"), new_password_path(resource_name) diff --git a/app/views/devise/shared/_providers.haml b/app/views/devise/shared/_providers.haml new file mode 100644 index 000000000..f7cdc00c4 --- /dev/null +++ b/app/views/devise/shared/_providers.haml @@ -0,0 +1,11 @@ +- if devise_mapping.omniauthable? + .hr + .other + .left + %p= t('layout.sessions.sign_up_with') + .right + - resource_class.omniauth_providers.each do |provider| + = link_to omniauth_authorize_path(resource_name, provider) do + - provider = provider.to_s.gsub(/_oauth2/,'') + = image_tag("#{provider}.png", :alt => provider) + .both \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index be090706d..0eefcfc6f 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -87,6 +87,7 @@ en: sessions: sign_in_header: Sign in + sign_up_with: "Sign up with:" private_users: list: List diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 1afe052cd..1b1974b31 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -87,6 +87,7 @@ ru: sessions: sign_in_header: Вход в систему + sign_up_with: "Зарегистрироваться с:" private_users: list: Список From abfe502b5ffefad456f5a7da3e14d669b19e6f9a Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 16:24:15 +0400 Subject: [PATCH 03/11] #30: update devise.rb and omniauth_callbacks_controller --- .../users/omniauth_callbacks_controller.rb | 26 +++++++++---------- config/initializers/devise.rb | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 35277c82d..99cad3cf7 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -1,10 +1,5 @@ # -*- encoding : utf-8 -*- class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController - require 'uuidtools' - - # def facebook - # generic - # end def facebook oauthorize 'Facebook' @@ -40,30 +35,35 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController provider, uid = auth['provider'], auth['uid'] authentication = Authentication.find_or_initialize_by_provider_and_uid(provider, uid) if authentication.new_record? - unless user_signed_in? # Register new user from session + if user_signed_in? # Register new user from session + authentication.user = current_user + else case provider when 'facebook' name = auth['extra']['raw_info']['name'] email = auth['info']['email'] when 'google_oauth2' - name = auth['info']['nickname'] + name = auth['info']['name'] email = auth['info']['email'] when 'github' - + name = auth['info']['nickname'] + email = auth['info']['email'] || "#{name}@github.com" else raise 'Provider #{provider} not handled' end - user = User.create( - :uname => "#{provider}-#{uid}", + user = User.create!( + :uname => "#{provider.gsub(/_oauth2/,'')}_#{uid}", :name => name, :email => email, :password => Devise.friendly_token[0,20] ) + user.confirmed_at = Time.zone.now + user.save + authentication.user = user end - authentication.user = current_user - authentication.save + authentication.save! end - return user + return authentication.user end end \ No newline at end of file diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index be74b0c29..bc4951c40 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -182,7 +182,7 @@ Devise.setup do |config| # config.navigational_formats = [:"*/*", "*/*", :html] # The default HTTP method used to sign out a resource. Default is :delete. - config.sign_out_via = :get + config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting From cd98088e7f406ef40ec15962cbf0c36418d420df Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 17:22:25 +0400 Subject: [PATCH 04/11] #30: find user by email before registration --- Gemfile | 2 -- .../users/omniauth_callbacks_controller.rb | 18 +++++++++--------- app/models/user.rb | 14 -------------- config/initializers/devise.rb | 2 +- config/initializers/omniauth.rb | 8 -------- 5 files changed, 10 insertions(+), 34 deletions(-) diff --git a/Gemfile b/Gemfile index 4b7317e2b..99c57eb49 100644 --- a/Gemfile +++ b/Gemfile @@ -7,13 +7,11 @@ gem 'pg', '~> 0.14.0' gem 'devise', '~> 2.2.3' gem 'omniauth' -# gem 'oa-oauth', :require => 'omniauth/oauth' gem 'omniauth-facebook' gem 'omniauth-google-oauth2' gem 'omniauth-github' # gem 'omniauth-openid', '~> 1.0.1' gem 'cancan', '1.6.7' # 1.6.8 fail specs with strange error -# gem 'uuidtools' gem 'ancestry', '~> 1.3.0' gem 'paperclip', '~> 3.3.1' diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 99cad3cf7..4e13d8833 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -47,18 +47,18 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController email = auth['info']['email'] when 'github' name = auth['info']['nickname'] - email = auth['info']['email'] || "#{name}@github.com" + email = auth['info']['email'] else raise 'Provider #{provider} not handled' end - user = User.create!( - :uname => "#{provider.gsub(/_oauth2/,'')}_#{uid}", - :name => name, - :email => email, - :password => Devise.friendly_token[0,20] - ) - user.confirmed_at = Time.zone.now - user.save + user = User.find_or_initialize_by_email(email) + if user.new_record? + user.name = name + user.uname = name.gsub(/\s/, '').underscore + user.password = Devise.friendly_token[0,20] + user.confirmed_at = Time.zone.now + user.save + end authentication.user = user end authentication.save! diff --git a/app/models/user.rb b/app/models/user.rb index fce41e6b6..71854e991 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -99,20 +99,6 @@ class User < Avatar { :value => login.downcase, :orig_value => login }]).first end - def new_with_session(params, session) - super.tap do |user| - if data = session["devise.omniauth_data"] - if info = data['info'] and info.present? - user.email = info['email'].presence if user.email.blank? - user.uname ||= info['nickname'].presence || info['username'].presence - user.name ||= info['name'].presence || [info['first_name'], info['last_name']].join(' ').strip - end - user.password = Devise.friendly_token[0,20] # stub password - user.authentications.build :uid => data['uid'], :provider => data['provider'] - end - end - end - def auth_by_token_or_login_pass(user, pass) u = User.find_for_database_authentication(:login => user) u if u && !u.access_locked? && (u.authentication_token == user || u.valid_password?(pass)) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index bc4951c40..a0b635a4f 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -194,7 +194,7 @@ Devise.setup do |config| config.omniauth :facebook, APP_CONFIG['keys']['facebook']['id'], APP_CONFIG['keys']['facebook']['secret'] config.omniauth :google_oauth2, APP_CONFIG['keys']['google']['id'], APP_CONFIG['keys']['google']['secret'], {:access_type => 'offline', :approval_prompt => ''} - config.omniauth :github, APP_CONFIG['keys']['github']['id'], APP_CONFIG['keys']['github']['secret'] + config.omniauth :github, APP_CONFIG['keys']['github']['id'], APP_CONFIG['keys']['github']['secret'], {:scope => 'user'} # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index ac5e72a76..d5f26a3d8 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,9 +1 @@ -# require "omniauth-facebook" - -# Rails.application.config.middleware.use OmniAuth::Builder do -# [:facebook, :github, :google_oauth2].each do |kind| -# provider kind, APP_CONFIG['keys']["#{kind}"]['id'], APP_CONFIG['keys']["#{kind}"]['secret'] -# end -# end - OmniAuth.config.logger = Rails.logger \ No newline at end of file From 69c226be0b3aef81af5a7a22d1267ef217420b9f Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 17:30:43 +0400 Subject: [PATCH 05/11] #30: update comments, some refactoring --- app/controllers/users/omniauth_callbacks_controller.rb | 8 ++++---- app/models/authentication.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 4e13d8833..8c0cfa2cc 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -22,7 +22,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def oauthorize(kind) provider = kind.downcase @user = find_for_ouath(env["omniauth.auth"], current_user) - if @user.persisted? + if @user && @user.persisted? flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => action_name.classify sign_in_and_redirect @user, :event => :authentication else @@ -35,9 +35,9 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController provider, uid = auth['provider'], auth['uid'] authentication = Authentication.find_or_initialize_by_provider_and_uid(provider, uid) if authentication.new_record? - if user_signed_in? # Register new user from session + if user_signed_in? # New authentication method for current_user authentication.user = current_user - else + else # Register new user from session case provider when 'facebook' name = auth['extra']['raw_info']['name'] @@ -61,7 +61,7 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController end authentication.user = user end - authentication.save! + authentication.save end return authentication.user end diff --git a/app/models/authentication.rb b/app/models/authentication.rb index 0f29e3da9..e87f63c44 100644 --- a/app/models/authentication.rb +++ b/app/models/authentication.rb @@ -2,6 +2,6 @@ class Authentication < ActiveRecord::Base belongs_to :user - validates :provider, :uid, :presence => true + validates :provider, :uid, :user_id, :presence => true validates :uid, :uniqueness => {:scope => :provider, :case_sensitive => false} end From 960aecb6d5bff7bd5638677ff3c3785b52fb76c0 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 17:35:02 +0400 Subject: [PATCH 06/11] #30: refactoring of OmniauthCallbacksController#find_for_ouath --- .../users/omniauth_callbacks_controller.rb | 27 ++++++++----------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/app/controllers/users/omniauth_callbacks_controller.rb b/app/controllers/users/omniauth_callbacks_controller.rb index 8c0cfa2cc..6b94783aa 100644 --- a/app/controllers/users/omniauth_callbacks_controller.rb +++ b/app/controllers/users/omniauth_callbacks_controller.rb @@ -41,25 +41,20 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController case provider when 'facebook' name = auth['extra']['raw_info']['name'] - email = auth['info']['email'] - when 'google_oauth2' - name = auth['info']['name'] - email = auth['info']['email'] - when 'github' - name = auth['info']['nickname'] - email = auth['info']['email'] + when 'google_oauth2', 'github' + name = auth['info']['nickname'] || auth['info']['name'] else raise 'Provider #{provider} not handled' end - user = User.find_or_initialize_by_email(email) - if user.new_record? - user.name = name - user.uname = name.gsub(/\s/, '').underscore - user.password = Devise.friendly_token[0,20] - user.confirmed_at = Time.zone.now - user.save - end - authentication.user = user + user = User.find_or_initialize_by_email(auth['info']['email']) + if user.new_record? + user.name = name + user.uname = name.gsub(/\s/, '').underscore + user.password = Devise.friendly_token[0,20] + user.confirmed_at = Time.zone.now + user.save + end + authentication.user = user end authentication.save end From f903944e6df3d6edc232365b5ecd86027cbc6a4b Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 17:43:29 +0400 Subject: [PATCH 07/11] #30: update scope for github omniauth --- config/initializers/devise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index a0b635a4f..f7cadfd61 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -194,7 +194,7 @@ Devise.setup do |config| config.omniauth :facebook, APP_CONFIG['keys']['facebook']['id'], APP_CONFIG['keys']['facebook']['secret'] config.omniauth :google_oauth2, APP_CONFIG['keys']['google']['id'], APP_CONFIG['keys']['google']['secret'], {:access_type => 'offline', :approval_prompt => ''} - config.omniauth :github, APP_CONFIG['keys']['github']['id'], APP_CONFIG['keys']['github']['secret'], {:scope => 'user'} + config.omniauth :github, APP_CONFIG['keys']['github']['id'], APP_CONFIG['keys']['github']['secret'], {:scope => 'user:email'} # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or From 522e931761182a08c76265075502b80734d1cafe Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 26 Mar 2013 19:17:26 +0400 Subject: [PATCH 08/11] #30: update icon for facebook --- app/assets/images/facebook.png | Bin 3077 -> 2133 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/facebook.png b/app/assets/images/facebook.png index 80f6155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V(%rRT*Z6MH?i+i&_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx) ziK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01)YTo*JycSU)_*JOM-ImyzW$x>cP$Mz4ONYt z#^NJzM0w=t_X*$k9t}F$c8q(h;Rn+nb{%IOFKR-X@|s4QQ=0o*Vq3aT%s$c9>fU<% zN829{oHRUHc}nwC$!Xf@g42^{^3RN&m7RTlF8SPG+oHC6=VQ*_Y7cMkx)5~X(nbG^ z=R3SR&VO9;xODQe+vO8ixL2C5I$v$-bm~0*lhaSfyPUh4uDM)mx$b(swR>jw=^LIm z&fWCAdGQwi*43UlJ>9+YdT;l|_x0Zv-F|W>{m#p~*>@-It-MdXU-UrjLD@syht)q@ z{@mE_+<$7occAmp+(-8Yg@e!jk@b%cLj{kSkAKUC4TkHUI6gT!;y-fz>HMcd&t%Ug zo)`Y2{>!cx7B7DI)$7;J(U{Spm-3gBzioV_{p!H$8L!*M!p0uH$#^p{Ui4P`?ZJ24 zcOCDe-w#jZd?0@)|7iKK^;6KN`;!@ylm7$*nDhK&GcDTy001CkNK#Dz0D2_=0Dyx4 z0Dt-a004mL004C`008P>0026e000+nl3&F}0003nNkliZODl zvEqi~?}FVe4e)-w>gfw`299ZAUDscOseb?lH~`xbtPZdxZq@(}@am*SfL{f~&Pqd! z@ssr-(1)<^Lx}Q3*;^mNNzD(kFK4ZeyPCKez$N3`sP`wJ60@24x7g?hpgCVL>OV`+ zy_k_2HsYH-s$9Dou+gd8C9-6xy%a0~J&vVr4%ieywo7U>2h2-t3=jwAMu_ucQDpCc zRs?)j>q*!Scql;-1Dr%BUFJI{fcNXV_Dj>4YGo%hSfpk?({*002ovPDHLkV1h47yHEfC From 8de8b326d8b2d4db42fc1b03a468904e819e87e3 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 4 Apr 2013 15:52:54 +0400 Subject: [PATCH 09/11] #30: update facebook.png --- app/assets/images/facebook.png | Bin 2133 -> 2935 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/facebook.png b/app/assets/images/facebook.png index 669c8e1d6e00da1642e69b76d94bf1af9b31fcee..429c9425443c3a9924903f2fab1c94e2277b4bbc 100644 GIT binary patch delta 2912 zcmV-m3!n7W5cd|4Ba>4E6@Lm(X+uL$P-t&-Z*ypGa3D!TLm+T+Z)Rz1WdHzp+MQEp zR8#2|J@?-9LQ9B%luK_?6$l_wLW_VDktQl32@pz%A)(n7QNa;KMFbnjpojyGj)066 zQ7jCK3fKqaA)=0hqlk*i`{8?|Yu3E?=FR@K*FNX0^PRKL2fzpnmVZbyQ8j=JsX`tR z;Dg7+#^K~HK!FM*Z~zbpvt%K2{UZSY_f59&gh zTmgWD0l;*TI7e|ZE3OddDgXd@nX){&BsoQaTL>+22Uk}v z9w^R97b_GtVFF>AKrX_0nHe&HG!NkO%m4tOkrff(gY*4(&VLTB&dxTDwhmt{>c0m6 zB4T3W{^ifBa6kY6;dFk{{wy!E8h|?nfNlPwCGG@hUJIag_lst-4?wj5py}FI^Kkfn zJUm6Akh$5}<>chpO2k52Vaiv1{%68pz*qfj`F=e7_x0eu;v|7GU4cgg_~63K^h~83 z&yop*V%+ABM}Pdc3;+Bb(;~!4V!2o<6ys46agIcqjPo+3B8fthDa9qy|77CdEc*jK z-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S1Au6Q;m>#f??3%Vpd|o+W=WE9 z003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG3xE7zHiSYX#KJ-lLJDMn9CBbO ztb#%)hRv`YDqt_vKpix|QD}yfa1JiQRk#j4a1Z)n2%fLC6RbVIkUx0b+_+ zBaR3cnT7Zv!AJxWizFb)h!jyGOOZ85F;a?DAXP{m@;!0_Ifqlp|(=5QHQ7#Gr)$3XMd?XsE4X&sBct1q<&fbi3VB2Ov6t@q*0); zU*o*SAPZv|vv@2aYYnT0b%8a+Cb7-ge0D0knEf5Qi#@8Tp*ce{N;6lpQu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T9Wj^5100}7sELo=2s<8=k8taR-OE9#X0GnAtO_C{a)wXLYeJ6DBAUErBR!>H5< zG!hvX7l(*5L{Os6APvmS%#ivhBnqV`Kkcbt`h_;Rj!BZ(wo)k*B zh1ISI5Z5pYl@c9BiGWyp9ECXHg9+qaAB+5d`1kr)_D3cZw}}kADasF4PMV#)8Q)#J`ms3fj=rRew5$}W za3~-&ntcMlH;>^xZgeB{=UKf^z-%%_D<8bKDuy||RnG~ypX_oG!jme2N;Z87l8V|Z z7owc`@P&CEF?AvS#7fg!(~o{>)-@~dee3=rG4vzW8GW7M zSUHYwX7fil>!2@5=Y$K9lW*HmJ_mE!nbYLBIZV;hfrQST{r3B3<-CQO81@xq`jTc2 zExzz{k>4+QwJ}w7aHI2OY=g4}S5e7joK4P9=;|%^YOEr6^$Y){{$+_=`gx*8o_%>7 zYa_Wlt1s`3=@|%^J|p86iTU%YaS$p$=|ZyAe=OpQz0Jjpn>N*TxhWfPQ4bq60~JZc zqD-GXL)Hy_oWx3v^l1G^<4bJzVH{vnpSQMG*Auqctz6L-Uv8;w3T($h^@{r7ZGJ3s zTdMU+*i7M|4eZQW z1mG|uGIv5>f`^S8nN>yGOx)_3YOdC!x2ll2}jgEARcPgEzwrGIVK5#N7Q z`~x7|uAR88d3gz8s35HwS5tM3z{2$&*{fmBl<-r)WR88<5oT!1hio{Sw(dS;yJOC{ J`kzl-{4W*ay^H_= From cec46912a986b3411b0f471e27a8e5952d3273f4 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 4 Apr 2013 18:03:10 +0400 Subject: [PATCH 10/11] #30: update icon for google --- app/assets/images/google.png | Bin 3077 -> 3059 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/app/assets/images/google.png b/app/assets/images/google.png index 80f6155e073f4e9f879516c8b615dd5b3223933c..2ce2a7161deb9a0fc652e7d0fd80b50040b12c9d 100644 GIT binary patch delta 317 zcmV-D0mA-;81omfzzTmJNklf z-Dc_EGIF0t`W%nd*^*FZ^cF|fIsOAP>oRp<7x=x zEF#EZ_*EcBk|XUnZWTxippWL4g|-r;_Gb94Y3!B6Q+B2nb0|3P+)DIof--mNS41|a z^eKcvQg&AM_pLQ)^hOm{>t|lh#%aY#N7CiEn!>AGP%8@~epm{aiZODlvEqi~?}FVe4e)-w>gfw` z299ZAUDscOsQ?Bz0NW9)4zML|)&LIh>ZC@1Uj@X@N<)nCll6Zg(1)<^Lx}Q3*;^mN zNzD(kFK4ZeyPCKez$N3`sP`wJ60@24x7g?hpgCVL>OV`+y_k_2HsYH-s$9Dou+gd8 zC9-6xy%a0~J&vVr4%ieywo7U>2h2-t3=jwAMu_ucQSX3O1bkNON!Si}C_xYdoJ1#G z<~t{V_v^a$OVdY~YGo%hSfpk?({*002ovPDHLkV1j2#nU4Sf From 6e1798729efd85590b0b7f03f60474af9a5cc790 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 4 Apr 2013 18:19:49 +0400 Subject: [PATCH 11/11] #30: update styles --- app/assets/stylesheets/login.scss | 3 +++ app/assets/stylesheets/reg_session.scss | 3 +++ app/views/devise/shared/_providers.haml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/login.scss b/app/assets/stylesheets/login.scss index 8d7e34d3b..9dea52902 100644 --- a/app/assets/stylesheets/login.scss +++ b/app/assets/stylesheets/login.scss @@ -10,4 +10,7 @@ article { a { text-decoration: none; } + .facebook { + margin-right: -4px; + } } \ No newline at end of file diff --git a/app/assets/stylesheets/reg_session.scss b/app/assets/stylesheets/reg_session.scss index d8f145b3e..696780dac 100644 --- a/app/assets/stylesheets/reg_session.scss +++ b/app/assets/stylesheets/reg_session.scss @@ -34,6 +34,9 @@ article { a { text-decoration: none; } + .facebook { + margin-right: -4px; + } .other { .left { margin-top: 6px; diff --git a/app/views/devise/shared/_providers.haml b/app/views/devise/shared/_providers.haml index f7cdc00c4..d173f01d0 100644 --- a/app/views/devise/shared/_providers.haml +++ b/app/views/devise/shared/_providers.haml @@ -7,5 +7,5 @@ - resource_class.omniauth_providers.each do |provider| = link_to omniauth_authorize_path(resource_name, provider) do - provider = provider.to_s.gsub(/_oauth2/,'') - = image_tag("#{provider}.png", :alt => provider) + = image_tag("#{provider}.png", :alt => provider, :class => provider) .both \ No newline at end of file