diff --git a/.gitignore b/.gitignore index 46dd80c..c2596e0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,13 +31,7 @@ config/secrets.yml /.bundle /vendor/bundle -# These should all be checked in to normalise the environment. -# Gemfile.lock, .ruby-version, .ruby-gemset - -# Unless supporting rvm < 1.11.0 or doing something fancy, ignore this. .rvmrc -# If using bower-rails, ignore default bower_components path bower.json files. -/vendor/assets/bower_components -*.bowerrc -bower.json +# Ignore application configuration. +/config/application.yml diff --git a/Gemfile b/Gemfile index 7483aae..0c21528 100644 --- a/Gemfile +++ b/Gemfile @@ -1,49 +1,32 @@ source 'https://rubygems.org' - -# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'. gem 'rails', '4.1.6' -# Use sqlite3 as the database for Active Record. gem 'sqlite3' -# Use SCSS for stylesheets gem 'sass-rails', '~> 4.0.3' -# Use Uglifier as compressor for JavaScript assets. gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .js.coffee assets and views. +gem 'turbolinks' gem 'coffee-rails', '~> 4.0.0' -# See https://github.com/sstephenson/execjs#readme for more supported runtimes. -# gem 'therubyracer', platforms: :ruby - -# Use jquery as the JavaScript library. gem 'jquery-rails' -# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks. -gem 'turbolinks' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder. +gem 'font-awesome-rails' gem 'jbuilder', '~> 2.0' -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring. -gem 'spring', group: :development - -# Use ActiveModel has_secure_password. -# gem 'bcrypt', '~> 3.1.7' +gem 'sdoc', '~> 0.4.0', group: :doc +gem 'spring', group: :development -# Use unicorn as the app server. -# gem 'unicorn' +# Timezone data. +gem 'tzinfo-data' # Use Capistrano for deployment. -# gem 'capistrano-rails', group: :development gem 'capistrano', '~> 3.1.0' gem 'capistrano-bundler', '~> 1.1.2' gem 'capistrano-rails', '~> 1.1.1' gem 'capistrano-rbenv', github: "capistrano/rbenv" -# Use debugger. -# gem 'debugger', group: [:development, :test] +# User authentication: +gem 'devise' +gem 'cancancan' -# Timezone data. -gem 'tzinfo-data' +gem 'omniauth-facebook' +gem 'omniauth-google-oauth2' -# Devise for user authentication: -gem 'devise' +# Handle API secrets: +gem 'figaro' diff --git a/Gemfile.lock b/Gemfile.lock index 0b01e04..8c1512d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,6 +39,7 @@ GEM bcrypt (3.1.9) bcrypt (3.1.9-x86-mingw32) builder (3.2.2) + cancancan (1.12.0) capistrano (3.1.0) i18n rake (>= 10.0.0) @@ -66,6 +67,13 @@ GEM warden (~> 1.2.3) erubis (2.7.0) execjs (2.2.2) + faraday (0.9.1) + multipart-post (>= 1.2, < 3) + figaro (1.1.1) + thor (~> 0.14) + font-awesome-rails (4.4.0.0) + railties (>= 3.2, < 5.0) + hashie (3.4.2) hike (1.2.3) i18n (0.6.11) jbuilder (2.2.4) @@ -75,14 +83,34 @@ GEM railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) json (1.8.1) + jwt (1.5.1) mail (2.6.1) mime-types (>= 1.16, < 3) mime-types (2.4.3) minitest (5.4.2) multi_json (1.10.1) + multi_xml (0.5.5) + multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (2.9.1) + oauth2 (1.0.0) + faraday (>= 0.8, < 0.10) + jwt (~> 1.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (~> 1.2) + omniauth (1.2.2) + hashie (>= 1.2, < 4) + rack (~> 1.0) + omniauth-facebook (2.0.1) + omniauth-oauth2 (~> 1.2) + omniauth-google-oauth2 (0.2.6) + omniauth (> 1.0) + omniauth-oauth2 (~> 1.1) + omniauth-oauth2 (1.3.1) + oauth2 (~> 1.0) + omniauth (~> 1.2) orm_adapter (0.5.0) rack (1.5.2) rack-test (0.6.2) @@ -152,14 +180,19 @@ PLATFORMS x86-mingw32 DEPENDENCIES + cancancan capistrano (~> 3.1.0) capistrano-bundler (~> 1.1.2) capistrano-rails (~> 1.1.1) capistrano-rbenv! coffee-rails (~> 4.0.0) devise + figaro + font-awesome-rails jbuilder (~> 2.0) jquery-rails + omniauth-facebook + omniauth-google-oauth2 rails (= 4.1.6) sass-rails (~> 4.0.3) sdoc (~> 0.4.0) diff --git a/app/assets/fonts/glyphicons-halflings-regular.eot b/app/assets/fonts/glyphicons-halflings-regular.eot deleted file mode 100644 index 4a4ca86..0000000 Binary files a/app/assets/fonts/glyphicons-halflings-regular.eot and /dev/null differ diff --git a/app/assets/fonts/glyphicons-halflings-regular.svg b/app/assets/fonts/glyphicons-halflings-regular.svg deleted file mode 100644 index e3e2dc7..0000000 --- a/app/assets/fonts/glyphicons-halflings-regular.svg +++ /dev/null @@ -1,229 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/assets/fonts/glyphicons-halflings-regular.ttf b/app/assets/fonts/glyphicons-halflings-regular.ttf deleted file mode 100644 index 67fa00b..0000000 Binary files a/app/assets/fonts/glyphicons-halflings-regular.ttf and /dev/null differ diff --git a/app/assets/fonts/glyphicons-halflings-regular.woff b/app/assets/fonts/glyphicons-halflings-regular.woff deleted file mode 100644 index 8c54182..0000000 Binary files a/app/assets/fonts/glyphicons-halflings-regular.woff and /dev/null differ diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 411f083..2a5856c 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -10,16 +10,9 @@ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * + *= require font-awesome *= require bootstrap.min + *= require bootstrap-social.min *= require_tree . *= require_self */ - -@font-face { - font-family: 'Glyphicons Halflings'; - src: url('../assets/glyphicons-halflings-regular.eot'); - src: url('../assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), - url('../assets/glyphicons-halflings-regular.woff') format('woff'), - url('../assets/glyphicons-halflings-regular.ttf') format('truetype'), - url('../assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); -} diff --git a/app/assets/stylesheets/bootstrap-social.min.css b/app/assets/stylesheets/bootstrap-social.min.css new file mode 100644 index 0000000..a990247 --- /dev/null +++ b/app/assets/stylesheets/bootstrap-social.min.css @@ -0,0 +1,105 @@ +/* + * Social Buttons for Bootstrap + * + * Copyright 2013-2015 Panayiotis Lipiridis + * Licensed under the MIT License + * + * https://github.com/lipis/bootstrap-social + */ + +.btn-social{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.btn-social>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)} +.btn-social.btn-lg{padding-left:61px}.btn-social.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em} +.btn-social.btn-sm{padding-left:38px}.btn-social.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em} +.btn-social.btn-xs{padding-left:30px}.btn-social.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em} +.btn-social-icon{position:relative;padding-left:44px;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;height:34px;width:34px;padding:0}.btn-social-icon>:first-child{position:absolute;left:0;top:0;bottom:0;width:32px;line-height:34px;font-size:1.6em;text-align:center;border-right:1px solid rgba(0,0,0,0.2)} +.btn-social-icon.btn-lg{padding-left:61px}.btn-social-icon.btn-lg>:first-child{line-height:45px;width:45px;font-size:1.8em} +.btn-social-icon.btn-sm{padding-left:38px}.btn-social-icon.btn-sm>:first-child{line-height:28px;width:28px;font-size:1.4em} +.btn-social-icon.btn-xs{padding-left:30px}.btn-social-icon.btn-xs>:first-child{line-height:20px;width:20px;font-size:1.2em} +.btn-social-icon>:first-child{border:none;text-align:center;width:100% !important} +.btn-social-icon.btn-lg{height:45px;width:45px;padding-left:0;padding-right:0} +.btn-social-icon.btn-sm{height:30px;width:30px;padding-left:0;padding-right:0} +.btn-social-icon.btn-xs{height:22px;width:22px;padding-left:0;padding-right:0} +.btn-adn{color:#fff;background-color:#d87a68;border-color:rgba(0,0,0,0.2)}.btn-adn:hover,.btn-adn:focus,.btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{color:#fff;background-color:#ce563f;border-color:rgba(0,0,0,0.2)} +.btn-adn:active,.btn-adn.active,.open>.dropdown-toggle.btn-adn{background-image:none} +.btn-adn.disabled,.btn-adn[disabled],fieldset[disabled] .btn-adn,.btn-adn.disabled:hover,.btn-adn[disabled]:hover,fieldset[disabled] .btn-adn:hover,.btn-adn.disabled:focus,.btn-adn[disabled]:focus,fieldset[disabled] .btn-adn:focus,.btn-adn.disabled:active,.btn-adn[disabled]:active,fieldset[disabled] .btn-adn:active,.btn-adn.disabled.active,.btn-adn[disabled].active,fieldset[disabled] .btn-adn.active{background-color:#d87a68;border-color:rgba(0,0,0,0.2)} +.btn-adn .badge{color:#d87a68;background-color:#fff} +.btn-bitbucket{color:#fff;background-color:#205081;border-color:rgba(0,0,0,0.2)}.btn-bitbucket:hover,.btn-bitbucket:focus,.btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{color:#fff;background-color:#163758;border-color:rgba(0,0,0,0.2)} +.btn-bitbucket:active,.btn-bitbucket.active,.open>.dropdown-toggle.btn-bitbucket{background-image:none} +.btn-bitbucket.disabled,.btn-bitbucket[disabled],fieldset[disabled] .btn-bitbucket,.btn-bitbucket.disabled:hover,.btn-bitbucket[disabled]:hover,fieldset[disabled] .btn-bitbucket:hover,.btn-bitbucket.disabled:focus,.btn-bitbucket[disabled]:focus,fieldset[disabled] .btn-bitbucket:focus,.btn-bitbucket.disabled:active,.btn-bitbucket[disabled]:active,fieldset[disabled] .btn-bitbucket:active,.btn-bitbucket.disabled.active,.btn-bitbucket[disabled].active,fieldset[disabled] .btn-bitbucket.active{background-color:#205081;border-color:rgba(0,0,0,0.2)} +.btn-bitbucket .badge{color:#205081;background-color:#fff} +.btn-dropbox{color:#fff;background-color:#1087dd;border-color:rgba(0,0,0,0.2)}.btn-dropbox:hover,.btn-dropbox:focus,.btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{color:#fff;background-color:#0d6aad;border-color:rgba(0,0,0,0.2)} +.btn-dropbox:active,.btn-dropbox.active,.open>.dropdown-toggle.btn-dropbox{background-image:none} +.btn-dropbox.disabled,.btn-dropbox[disabled],fieldset[disabled] .btn-dropbox,.btn-dropbox.disabled:hover,.btn-dropbox[disabled]:hover,fieldset[disabled] .btn-dropbox:hover,.btn-dropbox.disabled:focus,.btn-dropbox[disabled]:focus,fieldset[disabled] .btn-dropbox:focus,.btn-dropbox.disabled:active,.btn-dropbox[disabled]:active,fieldset[disabled] .btn-dropbox:active,.btn-dropbox.disabled.active,.btn-dropbox[disabled].active,fieldset[disabled] .btn-dropbox.active{background-color:#1087dd;border-color:rgba(0,0,0,0.2)} +.btn-dropbox .badge{color:#1087dd;background-color:#fff} +.btn-facebook{color:#fff;background-color:#3b5998;border-color:rgba(0,0,0,0.2)}.btn-facebook:hover,.btn-facebook:focus,.btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{color:#fff;background-color:#2d4373;border-color:rgba(0,0,0,0.2)} +.btn-facebook:active,.btn-facebook.active,.open>.dropdown-toggle.btn-facebook{background-image:none} +.btn-facebook.disabled,.btn-facebook[disabled],fieldset[disabled] .btn-facebook,.btn-facebook.disabled:hover,.btn-facebook[disabled]:hover,fieldset[disabled] .btn-facebook:hover,.btn-facebook.disabled:focus,.btn-facebook[disabled]:focus,fieldset[disabled] .btn-facebook:focus,.btn-facebook.disabled:active,.btn-facebook[disabled]:active,fieldset[disabled] .btn-facebook:active,.btn-facebook.disabled.active,.btn-facebook[disabled].active,fieldset[disabled] .btn-facebook.active{background-color:#3b5998;border-color:rgba(0,0,0,0.2)} +.btn-facebook .badge{color:#3b5998;background-color:#fff} +.btn-flickr{color:#fff;background-color:#ff0084;border-color:rgba(0,0,0,0.2)}.btn-flickr:hover,.btn-flickr:focus,.btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{color:#fff;background-color:#cc006a;border-color:rgba(0,0,0,0.2)} +.btn-flickr:active,.btn-flickr.active,.open>.dropdown-toggle.btn-flickr{background-image:none} +.btn-flickr.disabled,.btn-flickr[disabled],fieldset[disabled] .btn-flickr,.btn-flickr.disabled:hover,.btn-flickr[disabled]:hover,fieldset[disabled] .btn-flickr:hover,.btn-flickr.disabled:focus,.btn-flickr[disabled]:focus,fieldset[disabled] .btn-flickr:focus,.btn-flickr.disabled:active,.btn-flickr[disabled]:active,fieldset[disabled] .btn-flickr:active,.btn-flickr.disabled.active,.btn-flickr[disabled].active,fieldset[disabled] .btn-flickr.active{background-color:#ff0084;border-color:rgba(0,0,0,0.2)} +.btn-flickr .badge{color:#ff0084;background-color:#fff} +.btn-foursquare{color:#fff;background-color:#f94877;border-color:rgba(0,0,0,0.2)}.btn-foursquare:hover,.btn-foursquare:focus,.btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{color:#fff;background-color:#f71752;border-color:rgba(0,0,0,0.2)} +.btn-foursquare:active,.btn-foursquare.active,.open>.dropdown-toggle.btn-foursquare{background-image:none} +.btn-foursquare.disabled,.btn-foursquare[disabled],fieldset[disabled] .btn-foursquare,.btn-foursquare.disabled:hover,.btn-foursquare[disabled]:hover,fieldset[disabled] .btn-foursquare:hover,.btn-foursquare.disabled:focus,.btn-foursquare[disabled]:focus,fieldset[disabled] .btn-foursquare:focus,.btn-foursquare.disabled:active,.btn-foursquare[disabled]:active,fieldset[disabled] .btn-foursquare:active,.btn-foursquare.disabled.active,.btn-foursquare[disabled].active,fieldset[disabled] .btn-foursquare.active{background-color:#f94877;border-color:rgba(0,0,0,0.2)} +.btn-foursquare .badge{color:#f94877;background-color:#fff} +.btn-github{color:#fff;background-color:#444;border-color:rgba(0,0,0,0.2)}.btn-github:hover,.btn-github:focus,.btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{color:#fff;background-color:#2b2b2b;border-color:rgba(0,0,0,0.2)} +.btn-github:active,.btn-github.active,.open>.dropdown-toggle.btn-github{background-image:none} +.btn-github.disabled,.btn-github[disabled],fieldset[disabled] .btn-github,.btn-github.disabled:hover,.btn-github[disabled]:hover,fieldset[disabled] .btn-github:hover,.btn-github.disabled:focus,.btn-github[disabled]:focus,fieldset[disabled] .btn-github:focus,.btn-github.disabled:active,.btn-github[disabled]:active,fieldset[disabled] .btn-github:active,.btn-github.disabled.active,.btn-github[disabled].active,fieldset[disabled] .btn-github.active{background-color:#444;border-color:rgba(0,0,0,0.2)} +.btn-github .badge{color:#444;background-color:#fff} +.btn-google{color:#fff;background-color:#dd4b39;border-color:rgba(0,0,0,0.2)}.btn-google:hover,.btn-google:focus,.btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{color:#fff;background-color:#c23321;border-color:rgba(0,0,0,0.2)} +.btn-google:active,.btn-google.active,.open>.dropdown-toggle.btn-google{background-image:none} +.btn-google.disabled,.btn-google[disabled],fieldset[disabled] .btn-google,.btn-google.disabled:hover,.btn-google[disabled]:hover,fieldset[disabled] .btn-google:hover,.btn-google.disabled:focus,.btn-google[disabled]:focus,fieldset[disabled] .btn-google:focus,.btn-google.disabled:active,.btn-google[disabled]:active,fieldset[disabled] .btn-google:active,.btn-google.disabled.active,.btn-google[disabled].active,fieldset[disabled] .btn-google.active{background-color:#dd4b39;border-color:rgba(0,0,0,0.2)} +.btn-google .badge{color:#dd4b39;background-color:#fff} +.btn-instagram{color:#fff;background-color:#3f729b;border-color:rgba(0,0,0,0.2)}.btn-instagram:hover,.btn-instagram:focus,.btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{color:#fff;background-color:#305777;border-color:rgba(0,0,0,0.2)} +.btn-instagram:active,.btn-instagram.active,.open>.dropdown-toggle.btn-instagram{background-image:none} +.btn-instagram.disabled,.btn-instagram[disabled],fieldset[disabled] .btn-instagram,.btn-instagram.disabled:hover,.btn-instagram[disabled]:hover,fieldset[disabled] .btn-instagram:hover,.btn-instagram.disabled:focus,.btn-instagram[disabled]:focus,fieldset[disabled] .btn-instagram:focus,.btn-instagram.disabled:active,.btn-instagram[disabled]:active,fieldset[disabled] .btn-instagram:active,.btn-instagram.disabled.active,.btn-instagram[disabled].active,fieldset[disabled] .btn-instagram.active{background-color:#3f729b;border-color:rgba(0,0,0,0.2)} +.btn-instagram .badge{color:#3f729b;background-color:#fff} +.btn-linkedin{color:#fff;background-color:#007bb6;border-color:rgba(0,0,0,0.2)}.btn-linkedin:hover,.btn-linkedin:focus,.btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{color:#fff;background-color:#005983;border-color:rgba(0,0,0,0.2)} +.btn-linkedin:active,.btn-linkedin.active,.open>.dropdown-toggle.btn-linkedin{background-image:none} +.btn-linkedin.disabled,.btn-linkedin[disabled],fieldset[disabled] .btn-linkedin,.btn-linkedin.disabled:hover,.btn-linkedin[disabled]:hover,fieldset[disabled] .btn-linkedin:hover,.btn-linkedin.disabled:focus,.btn-linkedin[disabled]:focus,fieldset[disabled] .btn-linkedin:focus,.btn-linkedin.disabled:active,.btn-linkedin[disabled]:active,fieldset[disabled] .btn-linkedin:active,.btn-linkedin.disabled.active,.btn-linkedin[disabled].active,fieldset[disabled] .btn-linkedin.active{background-color:#007bb6;border-color:rgba(0,0,0,0.2)} +.btn-linkedin .badge{color:#007bb6;background-color:#fff} +.btn-microsoft{color:#fff;background-color:#2672ec;border-color:rgba(0,0,0,0.2)}.btn-microsoft:hover,.btn-microsoft:focus,.btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{color:#fff;background-color:#125acd;border-color:rgba(0,0,0,0.2)} +.btn-microsoft:active,.btn-microsoft.active,.open>.dropdown-toggle.btn-microsoft{background-image:none} +.btn-microsoft.disabled,.btn-microsoft[disabled],fieldset[disabled] .btn-microsoft,.btn-microsoft.disabled:hover,.btn-microsoft[disabled]:hover,fieldset[disabled] .btn-microsoft:hover,.btn-microsoft.disabled:focus,.btn-microsoft[disabled]:focus,fieldset[disabled] .btn-microsoft:focus,.btn-microsoft.disabled:active,.btn-microsoft[disabled]:active,fieldset[disabled] .btn-microsoft:active,.btn-microsoft.disabled.active,.btn-microsoft[disabled].active,fieldset[disabled] .btn-microsoft.active{background-color:#2672ec;border-color:rgba(0,0,0,0.2)} +.btn-microsoft .badge{color:#2672ec;background-color:#fff} +.btn-odnoklassniki{color:#fff;background-color:#f4731c;border-color:rgba(0,0,0,0.2)}.btn-odnoklassniki:hover,.btn-odnoklassniki:focus,.btn-odnoklassniki:active,.btn-odnoklassniki.active,.open>.dropdown-toggle.btn-odnoklassniki{color:#fff;background-color:#d35b0a;border-color:rgba(0,0,0,0.2)} +.btn-odnoklassniki:active,.btn-odnoklassniki.active,.open>.dropdown-toggle.btn-odnoklassniki{background-image:none} +.btn-odnoklassniki.disabled,.btn-odnoklassniki[disabled],fieldset[disabled] .btn-odnoklassniki,.btn-odnoklassniki.disabled:hover,.btn-odnoklassniki[disabled]:hover,fieldset[disabled] .btn-odnoklassniki:hover,.btn-odnoklassniki.disabled:focus,.btn-odnoklassniki[disabled]:focus,fieldset[disabled] .btn-odnoklassniki:focus,.btn-odnoklassniki.disabled:active,.btn-odnoklassniki[disabled]:active,fieldset[disabled] .btn-odnoklassniki:active,.btn-odnoklassniki.disabled.active,.btn-odnoklassniki[disabled].active,fieldset[disabled] .btn-odnoklassniki.active{background-color:#f4731c;border-color:rgba(0,0,0,0.2)} +.btn-odnoklassniki .badge{color:#f4731c;background-color:#fff} +.btn-openid{color:#fff;background-color:#f7931e;border-color:rgba(0,0,0,0.2)}.btn-openid:hover,.btn-openid:focus,.btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{color:#fff;background-color:#da7908;border-color:rgba(0,0,0,0.2)} +.btn-openid:active,.btn-openid.active,.open>.dropdown-toggle.btn-openid{background-image:none} +.btn-openid.disabled,.btn-openid[disabled],fieldset[disabled] .btn-openid,.btn-openid.disabled:hover,.btn-openid[disabled]:hover,fieldset[disabled] .btn-openid:hover,.btn-openid.disabled:focus,.btn-openid[disabled]:focus,fieldset[disabled] .btn-openid:focus,.btn-openid.disabled:active,.btn-openid[disabled]:active,fieldset[disabled] .btn-openid:active,.btn-openid.disabled.active,.btn-openid[disabled].active,fieldset[disabled] .btn-openid.active{background-color:#f7931e;border-color:rgba(0,0,0,0.2)} +.btn-openid .badge{color:#f7931e;background-color:#fff} +.btn-pinterest{color:#fff;background-color:#cb2027;border-color:rgba(0,0,0,0.2)}.btn-pinterest:hover,.btn-pinterest:focus,.btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{color:#fff;background-color:#9f191f;border-color:rgba(0,0,0,0.2)} +.btn-pinterest:active,.btn-pinterest.active,.open>.dropdown-toggle.btn-pinterest{background-image:none} +.btn-pinterest.disabled,.btn-pinterest[disabled],fieldset[disabled] .btn-pinterest,.btn-pinterest.disabled:hover,.btn-pinterest[disabled]:hover,fieldset[disabled] .btn-pinterest:hover,.btn-pinterest.disabled:focus,.btn-pinterest[disabled]:focus,fieldset[disabled] .btn-pinterest:focus,.btn-pinterest.disabled:active,.btn-pinterest[disabled]:active,fieldset[disabled] .btn-pinterest:active,.btn-pinterest.disabled.active,.btn-pinterest[disabled].active,fieldset[disabled] .btn-pinterest.active{background-color:#cb2027;border-color:rgba(0,0,0,0.2)} +.btn-pinterest .badge{color:#cb2027;background-color:#fff} +.btn-reddit{color:#000;background-color:#eff7ff;border-color:rgba(0,0,0,0.2)}.btn-reddit:hover,.btn-reddit:focus,.btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{color:#000;background-color:#bcddff;border-color:rgba(0,0,0,0.2)} +.btn-reddit:active,.btn-reddit.active,.open>.dropdown-toggle.btn-reddit{background-image:none} +.btn-reddit.disabled,.btn-reddit[disabled],fieldset[disabled] .btn-reddit,.btn-reddit.disabled:hover,.btn-reddit[disabled]:hover,fieldset[disabled] .btn-reddit:hover,.btn-reddit.disabled:focus,.btn-reddit[disabled]:focus,fieldset[disabled] .btn-reddit:focus,.btn-reddit.disabled:active,.btn-reddit[disabled]:active,fieldset[disabled] .btn-reddit:active,.btn-reddit.disabled.active,.btn-reddit[disabled].active,fieldset[disabled] .btn-reddit.active{background-color:#eff7ff;border-color:rgba(0,0,0,0.2)} +.btn-reddit .badge{color:#eff7ff;background-color:#000} +.btn-soundcloud{color:#fff;background-color:#f50;border-color:rgba(0,0,0,0.2)}.btn-soundcloud:hover,.btn-soundcloud:focus,.btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{color:#fff;background-color:#c40;border-color:rgba(0,0,0,0.2)} +.btn-soundcloud:active,.btn-soundcloud.active,.open>.dropdown-toggle.btn-soundcloud{background-image:none} +.btn-soundcloud.disabled,.btn-soundcloud[disabled],fieldset[disabled] .btn-soundcloud,.btn-soundcloud.disabled:hover,.btn-soundcloud[disabled]:hover,fieldset[disabled] .btn-soundcloud:hover,.btn-soundcloud.disabled:focus,.btn-soundcloud[disabled]:focus,fieldset[disabled] .btn-soundcloud:focus,.btn-soundcloud.disabled:active,.btn-soundcloud[disabled]:active,fieldset[disabled] .btn-soundcloud:active,.btn-soundcloud.disabled.active,.btn-soundcloud[disabled].active,fieldset[disabled] .btn-soundcloud.active{background-color:#f50;border-color:rgba(0,0,0,0.2)} +.btn-soundcloud .badge{color:#f50;background-color:#fff} +.btn-tumblr{color:#fff;background-color:#2c4762;border-color:rgba(0,0,0,0.2)}.btn-tumblr:hover,.btn-tumblr:focus,.btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{color:#fff;background-color:#1c2d3f;border-color:rgba(0,0,0,0.2)} +.btn-tumblr:active,.btn-tumblr.active,.open>.dropdown-toggle.btn-tumblr{background-image:none} +.btn-tumblr.disabled,.btn-tumblr[disabled],fieldset[disabled] .btn-tumblr,.btn-tumblr.disabled:hover,.btn-tumblr[disabled]:hover,fieldset[disabled] .btn-tumblr:hover,.btn-tumblr.disabled:focus,.btn-tumblr[disabled]:focus,fieldset[disabled] .btn-tumblr:focus,.btn-tumblr.disabled:active,.btn-tumblr[disabled]:active,fieldset[disabled] .btn-tumblr:active,.btn-tumblr.disabled.active,.btn-tumblr[disabled].active,fieldset[disabled] .btn-tumblr.active{background-color:#2c4762;border-color:rgba(0,0,0,0.2)} +.btn-tumblr .badge{color:#2c4762;background-color:#fff} +.btn-twitter{color:#fff;background-color:#55acee;border-color:rgba(0,0,0,0.2)}.btn-twitter:hover,.btn-twitter:focus,.btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{color:#fff;background-color:#2795e9;border-color:rgba(0,0,0,0.2)} +.btn-twitter:active,.btn-twitter.active,.open>.dropdown-toggle.btn-twitter{background-image:none} +.btn-twitter.disabled,.btn-twitter[disabled],fieldset[disabled] .btn-twitter,.btn-twitter.disabled:hover,.btn-twitter[disabled]:hover,fieldset[disabled] .btn-twitter:hover,.btn-twitter.disabled:focus,.btn-twitter[disabled]:focus,fieldset[disabled] .btn-twitter:focus,.btn-twitter.disabled:active,.btn-twitter[disabled]:active,fieldset[disabled] .btn-twitter:active,.btn-twitter.disabled.active,.btn-twitter[disabled].active,fieldset[disabled] .btn-twitter.active{background-color:#55acee;border-color:rgba(0,0,0,0.2)} +.btn-twitter .badge{color:#55acee;background-color:#fff} +.btn-vimeo{color:#fff;background-color:#1ab7ea;border-color:rgba(0,0,0,0.2)}.btn-vimeo:hover,.btn-vimeo:focus,.btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{color:#fff;background-color:#1295bf;border-color:rgba(0,0,0,0.2)} +.btn-vimeo:active,.btn-vimeo.active,.open>.dropdown-toggle.btn-vimeo{background-image:none} +.btn-vimeo.disabled,.btn-vimeo[disabled],fieldset[disabled] .btn-vimeo,.btn-vimeo.disabled:hover,.btn-vimeo[disabled]:hover,fieldset[disabled] .btn-vimeo:hover,.btn-vimeo.disabled:focus,.btn-vimeo[disabled]:focus,fieldset[disabled] .btn-vimeo:focus,.btn-vimeo.disabled:active,.btn-vimeo[disabled]:active,fieldset[disabled] .btn-vimeo:active,.btn-vimeo.disabled.active,.btn-vimeo[disabled].active,fieldset[disabled] .btn-vimeo.active{background-color:#1ab7ea;border-color:rgba(0,0,0,0.2)} +.btn-vimeo .badge{color:#1ab7ea;background-color:#fff} +.btn-vk{color:#fff;background-color:#587ea3;border-color:rgba(0,0,0,0.2)}.btn-vk:hover,.btn-vk:focus,.btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{color:#fff;background-color:#466482;border-color:rgba(0,0,0,0.2)} +.btn-vk:active,.btn-vk.active,.open>.dropdown-toggle.btn-vk{background-image:none} +.btn-vk.disabled,.btn-vk[disabled],fieldset[disabled] .btn-vk,.btn-vk.disabled:hover,.btn-vk[disabled]:hover,fieldset[disabled] .btn-vk:hover,.btn-vk.disabled:focus,.btn-vk[disabled]:focus,fieldset[disabled] .btn-vk:focus,.btn-vk.disabled:active,.btn-vk[disabled]:active,fieldset[disabled] .btn-vk:active,.btn-vk.disabled.active,.btn-vk[disabled].active,fieldset[disabled] .btn-vk.active{background-color:#587ea3;border-color:rgba(0,0,0,0.2)} +.btn-vk .badge{color:#587ea3;background-color:#fff} +.btn-yahoo{color:#fff;background-color:#720e9e;border-color:rgba(0,0,0,0.2)}.btn-yahoo:hover,.btn-yahoo:focus,.btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{color:#fff;background-color:#500a6f;border-color:rgba(0,0,0,0.2)} +.btn-yahoo:active,.btn-yahoo.active,.open>.dropdown-toggle.btn-yahoo{background-image:none} +.btn-yahoo.disabled,.btn-yahoo[disabled],fieldset[disabled] .btn-yahoo,.btn-yahoo.disabled:hover,.btn-yahoo[disabled]:hover,fieldset[disabled] .btn-yahoo:hover,.btn-yahoo.disabled:focus,.btn-yahoo[disabled]:focus,fieldset[disabled] .btn-yahoo:focus,.btn-yahoo.disabled:active,.btn-yahoo[disabled]:active,fieldset[disabled] .btn-yahoo:active,.btn-yahoo.disabled.active,.btn-yahoo[disabled].active,fieldset[disabled] .btn-yahoo.active{background-color:#720e9e;border-color:rgba(0,0,0,0.2)} +.btn-yahoo .badge{color:#720e9e;background-color:#fff} diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb new file mode 100644 index 0000000..19454f5 --- /dev/null +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -0,0 +1,22 @@ +class OmniauthCallbacksController < Devise::OmniauthCallbacksController + def self.provides_callback_for(provider) + class_eval %Q{ + def #{provider} + @user = User.find_for_oauth(env["omniauth.auth"], current_user) + @user.skip_confirmation! if @user.respond_to?(:skip_confirmation) + + if @user.persisted? + sign_in_and_redirect @user, event: :authentication + set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format? + else + session["devise.#{provider}_data"] = env["omniauth.auth"] + redirect_to new_user_registration_url + end + end + } + end + + [:google_oauth2, :facebook].each do |provider| + provides_callback_for provider + end +end diff --git a/app/models/.keep b/app/models/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/models/identity.rb b/app/models/identity.rb new file mode 100644 index 0000000..16b1b0e --- /dev/null +++ b/app/models/identity.rb @@ -0,0 +1,11 @@ +class Identity < ActiveRecord::Base + belongs_to :user + validates_presence_of :uid, :provider + validates_uniqueness_of :uid, :scope => :provider + + def self.find_for_oauth(auth) + identity = find_by_provider_and_uid(auth.provider, auth.uid) + identity = create(:uid => auth.uid, :provider => auth.provider) if identity.nil? + identity + end +end diff --git a/app/models/user.rb b/app/models/user.rb index 86d7a29..33419e4 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,13 +1,14 @@ class User < ActiveRecord::Base - # Include default devise modules. Others available are: - # :confirmable, :lockable, :timeoutable and :omniauthable - devise :database_authenticatable, :registerable, + devise :database_authenticatable, :registerable, :omniauthable, :recoverable, :rememberable, :trackable, :validatable + has_one :wallet has_many :funds after_initialize :initialize_fields + TEMP_EMAIL_PREFIX = 'change@me' + def initialize_fields self.wallet = Wallet.new(points: DareKickstarter::Application.config.starting_points) end @@ -24,4 +25,33 @@ def self.new_user_params temp_password = (0...8).map { (65 + rand(26)).chr }.join { :password => temp_password, :password_confirmation => temp_password } end + + def self.find_for_oauth(auth, signed_in_resource = nil) + identity = Identity.find_for_oauth(auth) + + user = signed_in_resource ? signed_in_resource : identity.user + + if user.nil? + email = auth.info.email + user = User.where(:email => email).first if email + + # Create the user if it's a new registration. + if user.nil? + user = User.new( + :email => email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com", + :password => Devise.friendly_token[0, 20], + :name => auth.info.name + ) + user.skip_confirmation! if user.respond_to?(:skip_confirmation) + user.save! + end + end + + # Associate the identity with the user if needed: + if identity.user != user + identity.user = user + identity.save! + end + user + end end diff --git a/app/views/devise/confirmations/new.html.erb b/app/views/devise/confirmations/new.html.erb index 65ba288..3b45f6c 100644 --- a/app/views/devise/confirmations/new.html.erb +++ b/app/views/devise/confirmations/new.html.erb @@ -1,12 +1,20 @@ -

Resend confirmation instructions

+<% devise_error_messages! %> -<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> - <%= devise_error_messages! %> +
+
+
+
+ Resend Confirmation Instructions +
+
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, role: "form" }) do |f| %> +
+ <%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: 'Email Address' %> +
-
<%= f.label :email %>
- <%= f.email_field :email, autofocus: true %>
- -
<%= f.submit "Resend confirmation instructions" %>
-<% end %> - -<%= render "devise/shared/links" %> + <%= f.submit 'Resend Confirmation Instructions', class: 'btn btn-info center-block' %> + <% end %> +
+
+
+
diff --git a/app/views/devise/mailer/confirmation_instructions.html.erb b/app/views/devise/mailer/confirmation_instructions.html.erb index dc55f64..3af5058 100644 --- a/app/views/devise/mailer/confirmation_instructions.html.erb +++ b/app/views/devise/mailer/confirmation_instructions.html.erb @@ -1,5 +1,6 @@ -

Welcome <%= @email %>!

+

Welcome, <%= @resource.first_name %>!

-

You can confirm your account email through the link below:

+

You can confirm your account email by clicking this <%= link_to 'link', confirmation_url(@resource, confirmation_token: @token) %>.
+If that doesn't work, follow the link below:

-

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

+

<%= link_to confirmation_url(@resource, confirmation_token: @token), confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/devise/mailer/reset_password_instructions.html.erb b/app/views/devise/mailer/reset_password_instructions.html.erb index f667dc1..de6e97e 100644 --- a/app/views/devise/mailer/reset_password_instructions.html.erb +++ b/app/views/devise/mailer/reset_password_instructions.html.erb @@ -1,8 +1,9 @@ -

Hello <%= @resource.email %>!

+

Hello, <%= @resource.first_name %>!

-

Someone has requested a link to change your password. You can do this through the link below.

+

Someone has requested a link to change your password. You can do this by clicking this <%= link_to 'link', edit_password_url(@resource, reset_password_token: @token) %>.
+If that doesn't work, follow the link below:

-

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

+

<%= link_to edit_password_url(@resource, reset_password_token: @token), edit_password_url(@resource, reset_password_token: @token) %>

-

If you didn't request this, please ignore this email.

-

Your password won't change until you access the link above and create a new one.

+

If you didn't request this, please ignore this email.
+Your password won't change until you access the link above and create a new one.

diff --git a/app/views/devise/mailer/unlock_instructions.html.erb b/app/views/devise/mailer/unlock_instructions.html.erb index 41e148b..d1e79dd 100644 --- a/app/views/devise/mailer/unlock_instructions.html.erb +++ b/app/views/devise/mailer/unlock_instructions.html.erb @@ -1,4 +1,4 @@ -

Hello <%= @resource.email %>!

+

Hello, <%= @resource.first_name %>!

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 5535098..3e07b7f 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -1,16 +1,31 @@ -

Change your password

+<% devise_error_messages! %> -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %> - <%= devise_error_messages! %> - <%= f.hidden_field :reset_password_token %> +
+
+
+
+ Change Your Password +
+
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, role: "form" }) do |f| %> + <%= f.hidden_field :reset_password_token %> -
<%= f.label :password, "New password" %>
- <%= f.password_field :password, autofocus: true, autocomplete: "off" %>
+
+ <%= f.password_field :password, autofocus: true, autocomplete: 'off', class: 'form-control', placeholder: 'New Password' %> +
-
<%= f.label :password_confirmation, "Confirm new password" %>
- <%= f.password_field :password_confirmation, autocomplete: "off" %>
+
+ <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control', placeholder: 'Confirm Password' %> +
-
<%= f.submit "Change my password" %>
-<% end %> - -<%= render "devise/shared/links" %> + <%= f.submit 'Change My Password', class: 'btn btn-info center-block' %> + <% end %> +
+
+ <% if devise_mapping.confirmable? && controller_name != 'confirmations' %> +
+ Didn't receive confirmation instructions? <%= link_to 'Resend instructions!', new_confirmation_path(resource_name) %> +
+ <% end %> +
+
diff --git a/app/views/devise/passwords/new.html.erb b/app/views/devise/passwords/new.html.erb index dc05c4f..3e2ca3d 100644 --- a/app/views/devise/passwords/new.html.erb +++ b/app/views/devise/passwords/new.html.erb @@ -1,18 +1,25 @@ -<%= devise_error_messages! %> +<% devise_error_messages! %> -<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: "form-horizontal", role: "form" }) do |f| %> -
- <%= f.label :email, class: 'col-sm-2 control-label' %> -
- <%= f.email_field :email, autofocus: true, class: 'form-control' %> -
-
+
+
+
+
+ Forgot Password? +
+
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, role: "form" }) do |f| %> +
+ <%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: 'Email Address' %> +
-
-
- <%= f.submit "Reset Password", class: 'btn btn-default' %> + <%= f.submit 'Reset Password', class: 'btn btn-info center-block' %> + <% end %> +
+ <% if devise_mapping.registerable? && controller_name != 'registrations' %> +
+ Don't have an account? <%= link_to 'Sign up!', new_registration_path(resource_name) %> +
+ <% end %>
-<% end %> - -<%= render "devise/shared/links" %> +
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index 7a0ed75..4bf1aab 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,32 +1,46 @@ -<%= devise_error_messages! %> +<% devise_error_messages! %> -<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "form-horizontal", role: "form" }) do |f| %> -
- <%= f.label :email, class: 'col-sm-2 control-label' %> -
- <%= f.email_field :email, autofocus: true, class: 'form-control' %> -
-
+
+
+
+
+ Sign Up +
+
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { role: 'form' }) do |f| %> +
+ <%= f.text_field :name, autofocus: true, class: 'form-control', placeholder: 'Name' %> +
-
- <%= f.label :password, class: 'col-sm-2 control-label' %> -
- <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> -
-
+
+ <%= f.email_field :email, class: 'form-control', placeholder: 'Email Address' %> +
-
- <%= f.label :password_confirmation, class: 'col-sm-2 control-label' %> -
- <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %> -
-
+
+
+
+ <%= f.password_field :password, autocomplete: 'off', class: 'form-control', placeholder: 'Password' %> +
+
+
+
+ <%= f.password_field :password_confirmation, autocomplete: 'off', class: 'form-control', placeholder: 'Confirm Password' %> +
+
+
+ + <%= f.submit 'Sign Up', class: 'btn btn-success center-block' %> -
-
- <%= f.submit "Sign Up", class: 'btn btn-default' %> +
+ + <%= render 'devise/shared/social' %> + <% end %> +
+ <%- if controller_name != 'sessions' %> +
+ Already have an account? <%= link_to "Log in!", new_session_path(resource_name) %>
+
+ <% end %>
-<% end %> - -<%= render "devise/shared/links" %> +
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index c472f06..3391d7e 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,35 +1,42 @@ -<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "form-horizontal", role: "form" }) do |f| %> -
- <%= f.label :email, class: 'col-sm-2 control-label' %> -
- <%= f.email_field :email, autofocus: true, class: 'form-control' %> -
-
+
+
+
+
+ Log In +
+
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { role: 'form' }) do |f| %> +
+ <%= f.email_field :email, autofocus: true, class: 'form-control', placeholder: 'Email Address' %> +
-
- <%= f.label :password, class: 'col-sm-2 control-label' %> -
- <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> -
-
+
+ <%= f.password_field :password, autocomplete: 'off', class: 'form-control', placeholder: 'Password' %> +
- <% if devise_mapping.rememberable? -%> -
-
-
- -
-
-
- <% end -%> +
+ <% if devise_mapping.rememberable? -%> + + <% end %> + <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> + <%= link_to 'Forgot password?', new_password_path(resource_name), class: 'pull-right' %> + <% end -%> +
+ + <%= f.submit 'Log In', class: 'btn btn-success center-block' %> + +
-
-
- <%= f.submit "Log In", class: 'btn btn-default' %> + <%= render 'devise/shared/social' %> + <% end %> +
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %> +
+ Don't have an account? <%= link_to 'Sign up!', new_registration_path(resource_name) %> +
+ <% end %>
-<% end %> - -<%= render "devise/shared/links" %> +
diff --git a/app/views/devise/shared/_social.html.erb b/app/views/devise/shared/_social.html.erb new file mode 100644 index 0000000..81f6111 --- /dev/null +++ b/app/views/devise/shared/_social.html.erb @@ -0,0 +1,9 @@ +<%= link_to user_omniauth_authorize_path(:facebook), class: 'btn btn-block btn-social btn-facebook' do %> + + Log in with Facebook +<% end %> +
+<%= link_to user_omniauth_authorize_path(:google_oauth2), class: 'btn btn-block btn-social btn-google' do %> + + Log in with Google +<% end %> diff --git a/config/application.yml.example b/config/application.yml.example new file mode 100644 index 0000000..d3a78eb --- /dev/null +++ b/config/application.yml.example @@ -0,0 +1,12 @@ +# Add configuration values here, as shown below + +facebook_public_key: 'INSERT_FACEBOOK_APP_ID' +facebook_private_key: 'INSERT_FACEBOOK_APP_SECRET' +google_public_key: 'INSERT_GOOGLE_PUBLIC_KEY' +google_private_key: 'INSERT_GOOGLE_PRIVATE_KEY' + +production: + facebook_public_key: 'INSERT_FACEBOOK_APP_ID' + facebook_private_key: 'INSERT_FACEBOOK_APP_SECRET' + google_public_key: 'INSERT_GOOGLE_PUBLIC_KEY' + google_private_key: 'INSERT_GOOGLE_PRIVATE_KEY' diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index be8a6a6..d320d45 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -256,4 +256,7 @@ # When using omniauth, Devise cannot automatically set Omniauth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' + + config.omniauth :facebook, ENV['facebook_public_key'], ENV['facebook_private_key'] + config.omniauth :google_oauth2, ENV['google_public_key'], ENV['google_private_key'] end diff --git a/config/routes.rb b/config/routes.rb index 515881b..93fa3cc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - devise_for :users + devise_for :users, :controllers => { :omniauth_callbacks => 'omniauth_callbacks' } get 'home/index' # The priority is based upon order of creation: first created -> highest priority. diff --git a/db/migrate/20150903212419_create_identities.rb b/db/migrate/20150903212419_create_identities.rb new file mode 100644 index 0000000..5b6049b --- /dev/null +++ b/db/migrate/20150903212419_create_identities.rb @@ -0,0 +1,12 @@ +class CreateIdentities < ActiveRecord::Migration + def change + create_table :identities do |t| + t.references :user + t.string :provider + t.string :uid + + t.timestamps + end + add_index :identities, :user_id + end +end diff --git a/db/migrate/20150903214415_add_name_to_users.rb b/db/migrate/20150903214415_add_name_to_users.rb new file mode 100644 index 0000000..bac750e --- /dev/null +++ b/db/migrate/20150903214415_add_name_to_users.rb @@ -0,0 +1,5 @@ +class AddNameToUsers < ActiveRecord::Migration + def change + add_column :users, :name, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 104520d..0268c21 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20141102032931) do +ActiveRecord::Schema.define(version: 20150903214415) do create_table "dares", force: true do |t| t.string "title" @@ -31,6 +31,16 @@ t.integer "user_id" end + create_table "identities", force: true do |t| + t.integer "user_id" + t.string "provider" + t.string "uid" + t.datetime "created_at" + t.datetime "updated_at" + end + + add_index "identities", ["user_id"], name: "index_identities_on_user_id" + create_table "users", force: true do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -44,6 +54,7 @@ t.string "last_sign_in_ip" t.datetime "created_at" t.datetime "updated_at" + t.string "name" end add_index "users", ["email"], name: "index_users_on_email", unique: true