├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README ├── README.textile ├── Rakefile ├── app ├── assets │ ├── images │ │ └── rails.png │ ├── javascripts │ │ ├── application.js │ │ ├── home.js.coffee │ │ └── users.js.coffee │ └── stylesheets │ │ ├── application.css │ │ ├── home.css.scss │ │ └── users.css.scss ├── controllers │ ├── application_controller.rb │ ├── home_controller.rb │ ├── sessions_controller.rb │ └── users_controller.rb ├── helpers │ ├── application_helper.rb │ ├── home_helper.rb │ └── users_helper.rb ├── mailers │ └── .gitkeep ├── models │ └── user.rb └── views │ ├── home │ └── index.html.erb │ ├── layouts │ └── application.html.erb │ ├── shared │ └── _navigation.html.erb │ └── users │ ├── edit.html.erb │ └── show.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cucumber.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── generators.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── omniauth.rb │ ├── secret_token.rb │ ├── session_store.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── mongoid.yml └── routes.rb ├── db └── seeds.rb ├── features ├── step_definitions │ └── web_steps.rb └── support │ ├── env.rb │ ├── paths.rb │ └── selectors.rb ├── lib └── tasks │ ├── .gitkeep │ └── cucumber.rake ├── public ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico └── robots.txt ├── script ├── cucumber └── rails ├── spec ├── controllers │ ├── home_controller_spec.rb │ └── users_controller_spec.rb ├── models │ └── user_spec.rb ├── spec_helper.rb └── support │ └── mongoid.rb └── vendor └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | #---------------------------------------------------------------------------- 2 | # Ignore these files when commiting to a git repository 3 | # 4 | # The original version of this file is found here: 5 | # https://github.com/RailsApps/rails3-application-templates/raw/master/files/gitignore.txt 6 | # 7 | # Corrections? Improvements? Create a GitHub issue: 8 | # http://github.com/RailsApps/rails3-application-templates/issues 9 | #---------------------------------------------------------------------------- 10 | 11 | # bundler state 12 | /.bundle 13 | /vendor/bundle/ 14 | 15 | # minimal Rails specific artifacts 16 | db/*.sqlite3 17 | /log/* 18 | tmp/* 19 | 20 | # various artifacts 21 | **.war 22 | *.rbc 23 | *.sassc 24 | .rspec 25 | .redcar/ 26 | .sass-cache 27 | /config/config.yml 28 | /config/database.yml 29 | /coverage.data 30 | /coverage/ 31 | /db/*.javadb/ 32 | /db/*.sqlite3-journal 33 | /doc/api/ 34 | /doc/app/ 35 | /doc/features.html 36 | /doc/specs.html 37 | /public/cache 38 | /public/stylesheets/compiled 39 | /public/system 40 | /spec/tmp/* 41 | /cache 42 | /capybara* 43 | /capybara-*.html 44 | /gems 45 | /rerun.txt 46 | /spec/requests 47 | /spec/routing 48 | /spec/views 49 | /specifications 50 | 51 | # scm revert files 52 | **.orig 53 | 54 | # Mac finder artifacts 55 | .DS_Store 56 | 57 | # Netbeans project directory 58 | /nbproject/ 59 | 60 | # Textmate project files 61 | /*.tmpproj 62 | 63 | # vim artifacts 64 | **.swp 65 | # keep OmniAuth service provider secrets out of the Git repo 66 | config/initializers/omniauth.rb 67 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | gem 'rails', '3.1.0.rc1' 3 | gem 'sass' 4 | gem 'coffee-script' 5 | gem 'uglifier' 6 | gem 'jquery-rails' 7 | gem "rspec-rails", ">= 2.6.1", :group => [:development, :test] 8 | gem "database_cleaner", ">= 0.6.7", :group => :test 9 | gem "mongoid-rspec", ">= 1.4.2", :group => :test 10 | gem "factory_girl_rails", ">= 1.1.beta1", :group => :test 11 | gem "cucumber-rails", ">= 0.5.1", :group => :test 12 | gem "capybara", ">= 1.0.0.beta1", :group => :test 13 | gem "launchy", ">= 0.4.0", :group => :test 14 | gem "bson_ext", ">= 1.3.1" 15 | gem "mongoid", ">= 2.0.2" 16 | gem "omniauth", ">= 0.2.6" 17 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: http://rubygems.org/ 3 | specs: 4 | actionmailer (3.1.0.rc1) 5 | actionpack (= 3.1.0.rc1) 6 | mail (~> 2.3.0) 7 | actionpack (3.1.0.rc1) 8 | activemodel (= 3.1.0.rc1) 9 | activesupport (= 3.1.0.rc1) 10 | builder (~> 3.0.0) 11 | erubis (~> 2.7.0) 12 | i18n (~> 0.6.0beta1) 13 | rack (~> 1.3.0.beta2) 14 | rack-cache (~> 1.0.1) 15 | rack-mount (~> 0.8.1) 16 | rack-test (~> 0.6.0) 17 | sprockets (~> 2.0.0.beta.5) 18 | tzinfo (~> 0.3.27) 19 | activemodel (3.1.0.rc1) 20 | activesupport (= 3.1.0.rc1) 21 | bcrypt-ruby (~> 2.1.4) 22 | builder (~> 3.0.0) 23 | i18n (~> 0.6.0beta1) 24 | activerecord (3.1.0.rc1) 25 | activemodel (= 3.1.0.rc1) 26 | activesupport (= 3.1.0.rc1) 27 | arel (~> 2.1.1) 28 | tzinfo (~> 0.3.27) 29 | activeresource (3.1.0.rc1) 30 | activemodel (= 3.1.0.rc1) 31 | activesupport (= 3.1.0.rc1) 32 | activesupport (3.1.0.rc1) 33 | multi_json (~> 1.0) 34 | addressable (2.2.4) 35 | arel (2.1.1) 36 | bcrypt-ruby (2.1.4) 37 | bson (1.3.1) 38 | bson_ext (1.3.1) 39 | builder (3.0.0) 40 | capybara (1.0.0.beta1) 41 | mime-types (>= 1.16) 42 | nokogiri (>= 1.3.3) 43 | rack (>= 1.0.0) 44 | rack-test (>= 0.5.4) 45 | selenium-webdriver (>= 0.0.27) 46 | xpath (~> 0.1.4) 47 | childprocess (0.1.9) 48 | ffi (~> 1.0.6) 49 | coffee-script (2.2.0) 50 | coffee-script-source 51 | execjs 52 | coffee-script-source (1.1.1) 53 | configuration (1.2.0) 54 | cucumber (0.10.3) 55 | builder (>= 2.1.2) 56 | diff-lcs (>= 1.1.2) 57 | gherkin (>= 2.3.8) 58 | json (>= 1.4.6) 59 | term-ansicolor (>= 1.0.5) 60 | cucumber-rails (0.5.1) 61 | capybara (>= 1.0.0.beta1) 62 | cucumber (>= 0.10.3) 63 | nokogiri (>= 1.4.4) 64 | rack-test (>= 0.5.7) 65 | database_cleaner (0.6.7) 66 | diff-lcs (1.1.2) 67 | erubis (2.7.0) 68 | execjs (1.0.0) 69 | multi_json (~> 1.0) 70 | factory_girl (2.0.0.beta2) 71 | factory_girl_rails (1.1.beta1) 72 | factory_girl (~> 2.0.0.beta) 73 | rails (>= 3.0.0) 74 | faraday (0.6.1) 75 | addressable (~> 2.2.4) 76 | multipart-post (~> 1.1.0) 77 | rack (>= 1.1.0, < 2) 78 | ffi (1.0.9) 79 | gherkin (2.3.10) 80 | json (>= 1.4.6) 81 | hike (1.0.0) 82 | i18n (0.6.0) 83 | jquery-rails (1.0.9) 84 | railties (~> 3.0) 85 | thor (~> 0.14) 86 | json (1.5.1) 87 | json_pure (1.5.1) 88 | launchy (0.4.0) 89 | configuration (>= 0.0.5) 90 | rake (>= 0.8.1) 91 | mail (2.3.0) 92 | i18n (>= 0.4.0) 93 | mime-types (~> 1.16) 94 | treetop (~> 1.4.8) 95 | mime-types (1.16) 96 | mongo (1.3.1) 97 | bson (>= 1.3.1) 98 | mongoid (2.0.2) 99 | activemodel (~> 3.0) 100 | mongo (~> 1.3) 101 | tzinfo (~> 0.3.22) 102 | mongoid-rspec (1.4.2) 103 | mongoid (~> 2.0) 104 | rspec (~> 2) 105 | multi_json (1.0.3) 106 | multi_xml (0.2.2) 107 | multipart-post (1.1.2) 108 | net-ldap (0.2.2) 109 | nokogiri (1.4.4) 110 | oa-basic (0.2.6) 111 | oa-core (= 0.2.6) 112 | rest-client (~> 1.6.0) 113 | oa-core (0.2.6) 114 | oa-enterprise (0.2.6) 115 | addressable (= 2.2.4) 116 | net-ldap (~> 0.2.2) 117 | nokogiri (~> 1.4.2) 118 | oa-core (= 0.2.6) 119 | pyu-ruby-sasl (~> 0.0.3.1) 120 | rubyntlm (~> 0.1.1) 121 | oa-more (0.2.6) 122 | multi_json (~> 1.0.0) 123 | oa-core (= 0.2.6) 124 | rest-client (~> 1.6.0) 125 | oa-oauth (0.2.6) 126 | faraday (~> 0.6.1) 127 | multi_json (~> 1.0.0) 128 | multi_xml (~> 0.2.2) 129 | oa-core (= 0.2.6) 130 | oauth (~> 0.4.0) 131 | oauth2 (~> 0.4.1) 132 | oa-openid (0.2.6) 133 | oa-core (= 0.2.6) 134 | rack-openid (~> 1.3.1) 135 | ruby-openid-apps-discovery (~> 1.2.0) 136 | oauth (0.4.4) 137 | oauth2 (0.4.1) 138 | faraday (~> 0.6.1) 139 | multi_json (>= 0.0.5) 140 | omniauth (0.2.6) 141 | oa-basic (= 0.2.6) 142 | oa-core (= 0.2.6) 143 | oa-enterprise (= 0.2.6) 144 | oa-more (= 0.2.6) 145 | oa-oauth (= 0.2.6) 146 | oa-openid (= 0.2.6) 147 | polyglot (0.3.1) 148 | pyu-ruby-sasl (0.0.3.3) 149 | rack (1.3.0) 150 | rack-cache (1.0.2) 151 | rack (>= 0.4) 152 | rack-mount (0.8.1) 153 | rack (>= 1.0.0) 154 | rack-openid (1.3.1) 155 | rack (>= 1.1.0) 156 | ruby-openid (>= 2.1.8) 157 | rack-ssl (1.3.2) 158 | rack 159 | rack-test (0.6.0) 160 | rack (>= 1.0) 161 | rails (3.1.0.rc1) 162 | actionmailer (= 3.1.0.rc1) 163 | actionpack (= 3.1.0.rc1) 164 | activerecord (= 3.1.0.rc1) 165 | activeresource (= 3.1.0.rc1) 166 | activesupport (= 3.1.0.rc1) 167 | bundler (~> 1.0) 168 | railties (= 3.1.0.rc1) 169 | railties (3.1.0.rc1) 170 | actionpack (= 3.1.0.rc1) 171 | activesupport (= 3.1.0.rc1) 172 | rack-ssl (~> 1.3.2) 173 | rake (>= 0.8.7) 174 | thor (~> 0.14.6) 175 | rake (0.9.1) 176 | rest-client (1.6.1) 177 | mime-types (>= 1.16) 178 | rspec (2.6.0) 179 | rspec-core (~> 2.6.0) 180 | rspec-expectations (~> 2.6.0) 181 | rspec-mocks (~> 2.6.0) 182 | rspec-core (2.6.3) 183 | rspec-expectations (2.6.0) 184 | diff-lcs (~> 1.1.2) 185 | rspec-mocks (2.6.0) 186 | rspec-rails (2.6.1) 187 | actionpack (~> 3.0) 188 | activesupport (~> 3.0) 189 | railties (~> 3.0) 190 | rspec (~> 2.6.0) 191 | ruby-openid (2.1.8) 192 | ruby-openid-apps-discovery (1.2.0) 193 | ruby-openid (>= 2.1.7) 194 | rubyntlm (0.1.1) 195 | rubyzip (0.9.4) 196 | sass (3.1.2) 197 | selenium-webdriver (0.2.1) 198 | childprocess (>= 0.1.7) 199 | ffi (>= 1.0.7) 200 | json_pure 201 | rubyzip 202 | sprockets (2.0.0.beta.9) 203 | hike (~> 1.0) 204 | rack (~> 1.0) 205 | tilt (!= 1.3.0, ~> 1.1) 206 | term-ansicolor (1.0.5) 207 | thor (0.14.6) 208 | tilt (1.3.2) 209 | treetop (1.4.9) 210 | polyglot (>= 0.3.1) 211 | tzinfo (0.3.27) 212 | uglifier (0.5.4) 213 | execjs (>= 0.3.0) 214 | multi_json (>= 1.0.2) 215 | xpath (0.1.4) 216 | nokogiri (~> 1.3) 217 | 218 | PLATFORMS 219 | ruby 220 | 221 | DEPENDENCIES 222 | bson_ext (>= 1.3.1) 223 | capybara (>= 1.0.0.beta1) 224 | coffee-script 225 | cucumber-rails (>= 0.5.1) 226 | database_cleaner (>= 0.6.7) 227 | factory_girl_rails (>= 1.1.beta1) 228 | jquery-rails 229 | launchy (>= 0.4.0) 230 | mongoid (>= 2.0.2) 231 | mongoid-rspec (>= 1.4.2) 232 | omniauth (>= 0.2.6) 233 | rails (= 3.1.0.rc1) 234 | rspec-rails (>= 2.6.1) 235 | sass 236 | uglifier 237 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Rails3 Mongoid Omniauth 2 | ======================== 3 | 4 | This is an example Rails 3 application that combines OmniAuth with Mongoid. It uses the OmniAuth gem to manage authentication using a service provider such as Twitter or Facebook. MongoDB is used as a datastore with the Mongoid gem for quick development without schemas or migrations. 5 | 6 | ________________________ 7 | 8 | Tutorial 9 | 10 | A complete "walkthrough" tutorial is available on the GitHub wiki: 11 | 12 | https://github.com/railsapps/rails3-mongoid-omniauth/wiki/Tutorial 13 | 14 | ________________________ 15 | 16 | See the README file on GitHub 17 | 18 | For more information, please see the updated README file on GitHub: 19 | 20 | https://github.com/railsapps/rails3-mongoid-omniauth 21 | 22 | ________________________ 23 | 24 | Public Domain Dedication 25 | 26 | This work is a compilation and derivation from other previously released works. With the exception of various included works, which may be restricted by other licenses, the author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this code under copyright law. 27 | -------------------------------------------------------------------------------- /README.textile: -------------------------------------------------------------------------------- 1 | h1. Rails 3 + Mongoid + Omniauth 2 | 3 | This is an example *Rails 3 application* that combines *OmniAuth* with *Mongoid*. It uses the "OmniAuth":https://github.com/intridea/omniauth gem to manage authentication using a service provider such as Twitter or Facebook. MongoDB is used as a datastore with the "Mongoid":http://mongoid.org/ gem for quick development without schemas or migrations. 4 | 5 | Best of all, there's a "detailed tutorial":https://github.com/RailsApps/rails3-mongoid-omniauth/wiki/Tutorial (walk-through) to show how it's built. 6 | 7 | * *Service Providers:* Facebook, Twitter, GitHub, LinkedIn, and "many more":https://github.com/intridea/omniauth. 8 | * *Gems:* Mongoid and OmniAuth plus optional jQuery, Haml, RSpec and Cucumber. 9 | 10 | You can clone this app or generate a new Rails application using this app as a template. 11 | 12 | Any issues? Please create a "GitHub issue":http://github.com/RailsApps/rails3-mongoid-omniauth/issues. 13 | 14 | h2. !http://twitter-badges.s3.amazonaws.com/t_logo-a.png(Follow on Twitter)!:http://www.twitter.com/rails_apps Follow on Twitter !http://railsapps.github.com/images/mailing-list-icon.jpg(Join the Mailing List)!:http://eepurl.com/dQx3o Join the Mailing List 15 | 16 | Follow the project on Twitter: "@rails_apps":http://twitter.com/rails_apps. Please tweet some praise if you like what you've found. 17 | 18 | Join the email list (low volume, announcements only) for project updates and my tips about Rails resources. 19 | 20 | h2. !http://railsapps.github.com/images/rails-36x36.jpg(Tutorial)! Tutorial 21 | 22 | A complete walkthrough tutorial is available on the GitHub wiki: 23 | 24 | h4. "View the Tutorial":https://github.com/RailsApps/rails3-mongoid-omniauth/wiki/Tutorial 25 | 26 | The tutorial documents each step to follow to create the application. Every step is documented concisely, so a complete beginner can create this application without any additional knowledge. However, no explanation is offered for any of the steps, so if you are a beginner, you’re advised to look for an introduction to Rails elsewhere. See a list of "recommended books and online resources for learning Rails":http://railsapps.github.com/best-recommended-learning-rails-books-resources.html. 27 | 28 | If you simply wish to modify the application for your own project, you can download the application and set it up as described below, without following the tutorial. 29 | 30 | h2. What Is Implemented -- and What Is Not 31 | 32 | This is a demonstration application that allows you to visit a home page and see a list of users. You can log in using a service provider such as Twitter and view a profile for each user. You can customize this app as you need. 33 | 34 | h4. Single Provider or Multiple Providers? 35 | 36 | This application is designed for sign-in with a *single provider*. For example, you may be creating an application just for Twitter users. Alternatively, it's possible to create an application that lets a user log in using *multiple providers*. For these more complex applications, see other examples and tutorials listed below. 37 | 38 | h4. When to use Devise? 39 | 40 | "Devise":http://github.com/plataformatec/devise provides authentication using username (or email address) and password. If you don't need the option of using a username/password, that is, if you wish to have all your users sign in using a service provider's account (such as Twitter or Facebook), there's no need to use Devise. Devise can be used in conjunction with the OmniAuth gem when you need to offer users the option of signing up for access to a website using an email address. For example, combine Devise with OmniAuth to accommodate users who want to log in with various service providers (Twitter, Facebook, etc.) as well as users who don't have external accounts and want to sign up with just an email address. See suggestions below for tutorials and examples that combine Devise with OmniAuth. 41 | 42 | h4. The Email Problem 43 | 44 | You don't need to ask a visitor for an email address when you build an application that allows a user to log in using a service provider such as Twitter or Facebook. You may consider that an advantage: if a user is logged in with Twitter or Facebook, they don't need to enter an email address and password to access your application. However, the lack of an email address may be a business drawback, if you want the opportunity to stay in contact with the user by email. Some service providers provide the user's email address to your application (Facebook). Some service providers only provide the email address at the user's option (GitHub supplies it if the user has provided a public email address). And other service providers do not provide the email address at all (Twitter, LinkedIn). 45 | 46 | This example app shows how to request an email address from the user when he or she first requests access to your application. It is easy to remove this feature if you don't require it. 47 | 48 | h4. Similar Examples and Tutorials 49 | 50 | |_. Author |_. Example App |_. Comments | 51 | | Ryan Bates | "Simple OmniAuth":http://railscasts.com/episodes/241-simple-omniauth | screencast | 52 | | Markus Proske | "OmniAuth Pure":http://www.communityguides.eu/articles/16 | example and tutorial for OmniAuth with multiple providers | 53 | | Markus Proske | "Devise and OmniAuth":http://www.communityguides.eu/articles/11 | example and tutorial for OmniAuth and Devise with multiple providers | 54 | | Daniel Kehoe | "Devise, RSpec, Cucumber":https://github.com/RailsApps/rails3-devise-rspec-cucumber | Detailed tutorial, app template, starter app, using SQLite | 55 | | Daniel Kehoe | "Devise, Mongoid":https://github.com/RailsApps/rails3-mongoid-devise | Detailed tutorial, app template, starter app, using MongoDB | 56 | | Fernando Tapia Rico | "Devise, OmniAuth, Mongoid":https://github.com/fertapric/rails3-mongoid-devise-omniauth | With tutorial, using MongoDB | 57 | 58 | See a list of additional "Rails examples, tutorials, and starter apps":http://railsapps.github.com/rails-examples-tutorials.html. 59 | 60 | h2. Obtaining API Keys 61 | 62 | Before installing the application, you may wish to contact the service provider you'll use to obtain any required API keys. The example assumes you will be using Twitter. 63 | 64 | h4. Twitter 65 | 66 | Visit "https://developer.twitter.com/apps/new":https://developer.twitter.com/apps/new to register your application. When you register your application, use the following values: 67 | 68 | |_. Application Website |_. Callback URL |_. Notes | 69 | | http://example.com | http://127.0.0.1:3000/ | http://localhost:3000/ doesn't work | 70 | 71 | h4. Facebook 72 | 73 | Visit "http://developers.facebook.com/setup":http://developers.facebook.com/setup to register your application. 74 | 75 | h4. GitHub 76 | 77 | Visit "https://github.com/account/applications/new":https://github.com/account/applications/new to register your application. 78 | 79 | h2. Dependencies 80 | 81 | Before running this app, you will need: 82 | 83 | * The Ruby language (version 1.9.2) 84 | ** @$ ruby -v@ 85 | * Rails 3.1 86 | ** @$ rails -v@ 87 | * Rake 0.9.1 88 | ** @$ rake --version@ 89 | * A working installation of "MongoDB":http://www.mongodb.org/ (version 1.6.0 or newer) 90 | 91 | You must update the standard Ruby installation from Rake 0.8.7 to Rake 0.9.1 before using the application templates to generate a new Rails app. 92 | 93 | See "Installing Rails 3.1":http://railsapps.github.com/installing-rails-3-1.html and "Managing Rails Versions and Gems":http://railsapps.github.com/managing-rails-versions-gems.html for detailed instructions and advice. 94 | 95 | h4. Installing MongoDB 96 | 97 | If you don't have MongoDB installed on your computer, you'll need to install it and set it up to be always running on your computer (run at launch). On Mac OS X, the easiest way to install MongoDB is to install "Homebrew":http://mxcl.github.com/homebrew/ and then run the following: 98 | 99 |
100 | brew install mongodb 101 |102 | 103 | Homebrew will provide post-installation instructions to get MongoDB running. The last line of the installation output shows you the MongoDB install location (for example, */usr/local/Cellar/mongodb/1.8.0-x86_64*). You'll find the MongoDB configuration file there. After an installation using Homebrew, the default data directory will be */usr/local/var/mongodb*. 104 | 105 | h2. Getting the Application 106 | 107 | You have several options for getting the code. 108 | 109 | h4. Downloading the Code 110 | 111 | If you simply wish to examine the example code, you can download the code ("clone the repository") with the command 112 | 113 | @$ git clone git://github.com/RailsApps/rails3-mongoid-omniauth.git@ 114 | 115 | The source code is managed with Git (a version control system). You'll need Git on your machine (install it from "http://git-scm.com/":http://git-scm.com/). 116 | 117 | h4. Using the Ready-Made Application Template 118 | 119 | You can use an application template to generate a new version of the example app. You’ll find an application template for this app in the "Rails Application Templates":https://github.com/RailsApps/rails3-application-templates repository. 120 | 121 | Use the command: 122 | 123 | @$ rails new APP_NAME -m https://github.com/RailsApps/rails3-application-templates/raw/master/rails3-mongoid-omniauth-template.rb -T -O@ 124 | 125 | Use the @-T -O@ flags to skip Test::Unit files and Active Record files. Add the @-J@ flag to skip Prototype files for Rails 3.0 (not needed for Rails 3.1). 126 | 127 | bq. You MUST be using Rails 3.0.4 or newer. Generating a Rails application from an “HTTPS” URL does not work in Rails 3.0.3 and earlier versions. 128 | 129 | This creates a new Rails app (with the @APP_NAME@ you provide) on your computer. 130 | 131 | The application generator template will ask you for your preferences: 132 | 133 | * Would you like to use jQuery instead of Prototype? (for Rails 3.0) 134 | * Would you like to use jQuery UI? (for Rails 3.0 or 3.1) 135 | * Would you like to use Haml instead of ERB? 136 | * Would you like to use RSpec instead of TestUnit? 137 | * Would you like to use factory_girl for test fixtures with RSpec? 138 | * Would you like to use Cucumber for your BDD? 139 | * Would you like to use Mongoid to connect to a MongoDB database? 140 | * Would you like to use OmniAuth for authentication? 141 | * Would you like to set a robots.txt file to ban spiders? 142 | 143 | h4. Use "Recipes" to Customize an Application Template 144 | 145 | The "tutorial":https://github.com/RailsApps/rails3-mongoid-omniauth/wiki/Tutorial shows how a customized application template can be assembled from "recipes." The application template was created using the "Rails Apps Composer":https://github.com/RailsApps/rails_apps_composer gem which provides a convenient way to assemble a reusable application template by selecting various "recipes" for popular Rails development packages. 146 | 147 | h4. Please Remember: Edit the README 148 | 149 | If you're open sourcing the app on GitHub, please edit the README file to add a description of the app and your contact info. Changing the README is important if you're using a clone of the example app. I've been mistaken (and contacted) as the author of apps that are copied from my example. 150 | 151 | h2. Getting Started 152 | 153 | h4. About Required Gems 154 | 155 | The application uses the following gems: 156 | 157 | * "rails":http://rubygems.org/gems/rails 158 | * "rspec-rails":http://rubygems.org/gems/rspec-rails 159 | * "database_cleaner":http://rubygems.org/gems/database_cleaner 160 | * "factory_girl_rails":http://rubygems.org/gems/factory_girl_rails 161 | * "cucumber-rails":http://rubygems.org/gems/cucumber-rails 162 | * "capybara":http://rubygems.org/gems/capybara 163 | * "mongoid":http://rubygems.org/gems/mongoid 164 | * "bson_ext":http://rubygems.org/gems/bson_ext 165 | * "omniauth":http://rubygems.org/gems/omniauth 166 | 167 | See an example "Rails 3.1 Gemfile":http://railsapps.github.com/rails-3-1-example-gemfile.html. 168 | 169 | See "Managing Rails Versions and Gems":http://railsapps.github.com/managing-rails-versions-gems.html for advice and details. 170 | 171 | h4. Install the Required Gems 172 | 173 | Install the required gems on your computer: 174 | 175 | @$ bundle install@ 176 | 177 | You can check which gems are installed on your computer with: 178 | 179 | @$ gem list --local@ 180 | 181 | Keep in mind that you have installed these gems locally. When you deploy the app to another server, the same gems (and versions) must be available. 182 | 183 | h4. Set Up Configuration for OmniAuth 184 | 185 | This app uses OmniAuth for user management and authentication. OmniAuth is at "https://github.com/intridea/omniauth":https://github.com/intridea/omniauth. 186 | 187 | You'll need an OmniAuth initialization file *config/initializers/omniauth.rb* set up for the service provider you'll use. For most service providers, you need to register your application and obtain API keys to use their authentication service. 188 | 189 | For Twitter: 190 | 191 |
192 | Rails.application.config.middleware.use OmniAuth::Builder do 193 | provider :twitter, 'KEY', 'SECRET' 194 | end 195 |196 | 197 | For Facebook: 198 | 199 |
200 | Rails.application.config.middleware.use OmniAuth::Builder do 201 | provider :facebook, 'KEY', 'SECRET' 202 | end 203 |204 | 205 | For others, see "Module: OmniAuth::Strategies":http://intridea.github.com/omniauth/OmniAuth/Strategies.html. 206 | 207 | h4. Keep Your API Keys Secret 208 | 209 | Make sure that the file *config/initializers/omniauth.rb* will not be added to your GitHub repository. If you've created a public repository and you commit the file with your API Keys, anyone who browses your repo will be able to obtain your API keys and masquerade as your application. 210 | 211 | Modify the *.gitignore* file before commiting the file with your API keys. Add: 212 | 213 |
214 | config/initializers/omniauth.rb 215 |216 | 217 | You'll need to keep a local copy of the file and recreate it if you replace your local repo with a clone from a remote Git repository. 218 | 219 | h4. Using the Database Seed File to Reset the Datastore 220 | 221 | You'll want a convenient way to reset the datastore. The file *db/seeds.rb* is set up to reset the MongoDB database. 222 | 223 |
224 | puts 'EMPTY THE MONGODB DATABASE' 225 | Mongoid.master.collections.reject { |c| c.name =~ /^system/}.each(&:drop) 226 |227 | 228 | When you wish to reset the MongoDB datastore you can run the command: 229 | 230 | @$ rake db:seed@ 231 | 232 | You can also use the *db/seeds.rb* file to initialize the datastore by creating and saving any model instances you need. 233 | 234 | h4. Test the App 235 | 236 | You can check that your app runs properly by entering the command 237 | 238 | @$ rails server@ 239 | 240 | To see your application in action, open a browser window and navigate to "http://localhost:3000/":http://localhost:3000. You should see the default user listed on the home page. When you click on the user's name, you should be required to log in before seeing the user's profile page. 241 | 242 | h2. Deploy to Heroku 243 | 244 | For your convenience, here are "instructions for deploying your app to Heroku":http://railsapps.github.com/rails-heroku-tutorial.html. Heroku provides low cost, easily configured Rails application hosting. 245 | 246 | h2. Testing 247 | 248 | The application contains RSpec unit tests and Cucumber scenarios and steps. The tests are minimal and can be improved. 249 | 250 | Please send the author a message, create an issue, or submit a pull request if you can contribute improved RSpec or Cucumber files. 251 | 252 | After installing the application, run @rake -T@ to check that rake tasks for RSpec and Cucumber are available. 253 | 254 | Run @rake spec@ to run all RSpec tests. 255 | 256 | Run @rake cucumber@ (or more simply, @cucumber@) to run all Cucumber scenarios and steps. 257 | 258 | h2. Documentation and Support 259 | 260 | This is the only documentation. 261 | 262 | Ryan Bates offers a "Railscast on Simple OmniAuth":http://railscasts.com/episodes/241-simple-omniauth. You can find documentation for "OmniAuth":https://github.com/intridea/omniauth at "https://github.com/intridea/omniauth":https://github.com/intridea/omniauth. There is an active "OmniAuth mailing list":http://groups.google.com/group/omniauth and you can submit "OmniAuth issues":https://github.com/intridea/omniauth/issues at GitHub. 263 | 264 | h4. Issues 265 | 266 | Please create a "issue on GitHub":http://github.com/RailsApps/rails3-mongoid-omniauth/issues if you identify any problems or have suggestions for improvements. 267 | 268 | h2. Contributing 269 | 270 | If you make improvements to this application, please share with others. 271 | 272 | Send the author a message, create an "issue":http://github.com/RailsApps/rails3-mongoid-omniauth/issues, or fork the project and submit a pull request. 273 | 274 | If you add functionality to this application, create an alternative implementation, or build an application that is similar, please contact me and I'll add a note to the README so that others can find your work. 275 | 276 | h2. Credits 277 | 278 | Daniel Kehoe ("http://danielkehoe.com/":http://danielkehoe.com/) implemented the application and wrote the tutorial. 279 | 280 | Is the app useful to you? Follow the project on Twitter: 281 | "@rails_apps":http://twitter.com/rails_apps 282 | and tweet some praise. I'd love to know you were helped out by what I've put together. 283 | 284 | h2. License 285 | 286 | h4. Public Domain Dedication 287 | 288 | This work is a compilation and derivation from other previously released works. With the exception of various included works, which may be restricted by other licenses, the author or authors of this code dedicate any and all copyright interest in this code to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this code under copyright law. 289 | 290 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | # Add your own tasks in files placed in lib/tasks ending in .rake, 3 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 4 | 5 | require File.expand_path('../config/application', __FILE__) 6 | 7 | Rails3MongoidOmniauth::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/assets/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edshadi/rails3-mongoid-omniauth/0410d77d25a0b894065d6a608f373b1dac4a7103/app/assets/images/rails.png -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into including all the files listed below. 2 | // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically 3 | // be included in the compiled file accessible from http://example.com/assets/application.js 4 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 5 | // the compiled file. 6 | // 7 | //= require jquery 8 | //= require jquery_ujs 9 | //= require_tree . 10 | -------------------------------------------------------------------------------- /app/assets/javascripts/home.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /app/assets/javascripts/users.js.coffee: -------------------------------------------------------------------------------- 1 | # Place all the behaviors and hooks related to the matching controller here. 2 | # All this logic will automatically be available in application.js. 3 | # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll automatically include all the stylesheets available in this directory 3 | * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at 4 | * the top of the compiled file, but it's generally better to create a new file per style scope. 5 | *= require_self 6 | *= require_tree . 7 | */ 8 | ul.hmenu { 9 | list-style: none; 10 | margin: 0 0 2em; 11 | padding: 0; 12 | } 13 | ul.hmenu li { 14 | display: inline; 15 | } 16 | #flash_notice, #flash_alert { 17 | padding: 5px 8px; 18 | margin: 10px 0; 19 | } 20 | #flash_notice { 21 | background-color: #CFC; 22 | border: solid 1px #6C6; 23 | } 24 | #flash_alert { 25 | background-color: #FCC; 26 | border: solid 1px #C66; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /app/assets/stylesheets/home.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Place all the styles related to the matching controller here. 3 | They will automatically be included in application.css. 4 | You can use Sass (SCSS) here: http://sass-lang.com/ 5 | */ 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/users.css.scss: -------------------------------------------------------------------------------- 1 | /* 2 | Place all the styles related to the matching controller here. 3 | They will automatically be included in application.css. 4 | You can use Sass (SCSS) here: http://sass-lang.com/ 5 | */ 6 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | helper_method :current_user 4 | helper_method :user_signed_in? 5 | helper_method :correct_user? 6 | 7 | private 8 | def current_user 9 | begin 10 | @current_user ||= User.find(session[:user_id]) if session[:user_id] 11 | rescue Mongoid::Errors::DocumentNotFound 12 | nil 13 | end 14 | end 15 | 16 | def user_signed_in? 17 | return true if current_user 18 | end 19 | 20 | def correct_user? 21 | @user = User.find(params[:id]) 22 | unless current_user == @user 23 | redirect_to root_url, :alert => "Access denied." 24 | end 25 | end 26 | 27 | def authenticate_user! 28 | if !current_user 29 | redirect_to root_url, :alert => 'You need to sign in for access to this page.' 30 | end 31 | end 32 | 33 | end 34 | -------------------------------------------------------------------------------- /app/controllers/home_controller.rb: -------------------------------------------------------------------------------- 1 | class HomeController < ApplicationController 2 | def index 3 | @users = User.all 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/sessions_controller.rb: -------------------------------------------------------------------------------- 1 | class SessionsController < ApplicationController 2 | 3 | def new 4 | redirect_to '/auth/twitter' 5 | end 6 | 7 | 8 | def create 9 | auth = request.env["omniauth.auth"] 10 | user = User.where(:provider => auth['provider'], 11 | :uid => auth['uid']).first || User.create_with_omniauth(auth) 12 | session[:user_id] = user.id 13 | if !user.email 14 | redirect_to edit_user_path(user), :alert => "Please enter your email address." 15 | else 16 | redirect_to root_url, :notice => 'Signed in!' 17 | end 18 | 19 | end 20 | 21 | def destroy 22 | session[:user_id] = nil 23 | redirect_to root_url, :notice => 'Signed out!' 24 | end 25 | 26 | def failure 27 | redirect_to root_url, :alert => "Authentication error: #{params[:message].humanize}" 28 | end 29 | 30 | end 31 | -------------------------------------------------------------------------------- /app/controllers/users_controller.rb: -------------------------------------------------------------------------------- 1 | class UsersController < ApplicationController 2 | before_filter :authenticate_user! 3 | before_filter :correct_user? 4 | 5 | def edit 6 | @user = User.find(params[:id]) 7 | end 8 | 9 | def update 10 | @user = User.find(params[:id]) 11 | if @user.update_attributes(params[:user]) 12 | redirect_to @user 13 | else 14 | render :edit 15 | end 16 | end 17 | 18 | 19 | def show 20 | @user = User.find(params[:id]) 21 | 22 | end 23 | 24 | end 25 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/home_helper.rb: -------------------------------------------------------------------------------- 1 | module HomeHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edshadi/rails3-mongoid-omniauth/0410d77d25a0b894065d6a608f373b1dac4a7103/app/mailers/.gitkeep -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User 2 | include Mongoid::Document 3 | field :provider, :type => String 4 | field :uid, :type => String 5 | field :name, :type => String 6 | field :email, :type => String 7 | attr_accessible :provider, :uid, :name, :email 8 | 9 | def self.create_with_omniauth(auth) 10 | begin 11 | create! do |user| 12 | user.provider = auth['provider'] 13 | user.uid = auth['uid'] 14 | if auth['user_info'] 15 | user.name = auth['user_info']['name'] if auth['user_info']['name'] # Twitter, Google, Yahoo, GitHub 16 | user.email = auth['user_info']['email'] if auth['user_info']['email'] # Google, Yahoo, GitHub 17 | end 18 | if auth['extra']['user_hash'] 19 | user.name = auth['extra']['user_hash']['name'] if auth['extra']['user_hash']['name'] # Facebook 20 | user.email = auth['extra']['user_hash']['email'] if auth['extra']['user_hash']['email'] # Facebook 21 | end 22 | end 23 | rescue Exception 24 | raise Exception, "cannot create user record" 25 | end 26 | end 27 | 28 | end 29 | 30 | -------------------------------------------------------------------------------- /app/views/home/index.html.erb: -------------------------------------------------------------------------------- 1 |
User: <%=link_to user.name, user %>
4 | <% end %> 5 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |Find me in app/views/users/show.html.erb
3 |User: <%= @user.name %>
4 |Email: <%= @user.email if @user.email %>
5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails3MongoidOmniauth::Application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | # require "active_record/railtie" 5 | require "action_controller/railtie" 6 | require "action_mailer/railtie" 7 | require "active_resource/railtie" 8 | # # require "rails/test_unit/railtie" 9 | 10 | # If you have a Gemfile, require the gems listed there, including any gems 11 | # you've limited to :test, :development, or :production. 12 | Bundler.require(:default, Rails.env) if defined?(Bundler) 13 | 14 | module Rails3MongoidOmniauth 15 | class Application < Rails::Application 16 | 17 | # don't generate RSpec tests for views and helpers 18 | config.generators do |g| 19 | g.view_specs false 20 | g.helper_specs false 21 | end 22 | 23 | # Settings in config/environments/* take precedence over those specified here. 24 | # Application configuration should go into files in config/initializers 25 | # -- all .rb files in that directory are automatically loaded. 26 | 27 | # Custom directories with classes and modules you want to be autoloadable. 28 | # config.autoload_paths += %W(#{config.root}/extras) 29 | 30 | # Only load the plugins named here, in the order given (default is alphabetical). 31 | # :all can be used as a placeholder for all plugins not explicitly named. 32 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 33 | 34 | # Activate observers that should always be running. 35 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 36 | 37 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 38 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 39 | # config.time_zone = 'Central Time (US & Canada)' 40 | 41 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 42 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 43 | # config.i18n.default_locale = :de 44 | 45 | # Please note that JavaScript expansions are *ignored altogether* if the asset 46 | # pipeline is enabled (see config.assets.enabled below). Put your defaults in 47 | # app/assets/javascripts/application.js in that case. 48 | # 49 | # JavaScript files you want as :defaults (application.js is always included). 50 | # config.action_view.javascript_expansions[:defaults] = %w(prototype prototype_ujs) 51 | 52 | # Configure the default encoding used in templates for Ruby 1.9. 53 | config.encoding = "utf-8" 54 | 55 | # Configure sensitive parameters which will be filtered from the log file. 56 | config.filter_parameters += [:password] 57 | 58 | # Enable the asset pipeline 59 | config.assets.enabled = true 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 5 | 6 | require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) 7 | -------------------------------------------------------------------------------- /config/cucumber.yml: -------------------------------------------------------------------------------- 1 | <% 2 | rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : "" 3 | rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}" 4 | std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} --strict --tags ~@wip" 5 | %> 6 | default: <%= std_opts %> features 7 | wip: --tags @wip:3 --wip features 8 | rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip 9 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Rails3MongoidOmniauth::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger 20 | config.active_support.deprecation = :log 21 | 22 | # Only use best-standards-support built into browsers 23 | config.action_dispatch.best_standards_support = :builtin 24 | end 25 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # Code is not reloaded between requests 5 | config.cache_classes = true 6 | 7 | # Full error reports are disabled and caching is turned on 8 | config.consider_all_requests_local = false 9 | config.action_controller.perform_caching = true 10 | 11 | # Disable Rails's static asset server (Apache or nginx will already do this) 12 | config.serve_static_assets = false 13 | 14 | # Compress both stylesheets and JavaScripts 15 | config.assets.js_compressor = :uglifier 16 | config.assets.css_compressor = :scss 17 | 18 | # Specifies the header that your server uses for sending files 19 | # (comment out if your front-end server doesn't support this) 20 | config.action_dispatch.x_sendfile_header = "X-Sendfile" # Use 'X-Accel-Redirect' for nginx 21 | 22 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 23 | # config.force_ssl = true 24 | 25 | # See everything in the log (default is :info) 26 | # config.log_level = :debug 27 | 28 | # Use a different logger for distributed setups 29 | # config.logger = SyslogLogger.new 30 | 31 | # Use a different cache store in production 32 | # config.cache_store = :mem_cache_store 33 | 34 | # Enable serving of images, stylesheets, and JavaScripts from an asset server 35 | # config.action_controller.asset_host = "http://assets.example.com" 36 | 37 | # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) 38 | # config.assets.precompile += %w( search.js ) 39 | 40 | # Disable delivery errors, bad email addresses will be ignored 41 | # config.action_mailer.raise_delivery_errors = false 42 | 43 | # Enable threaded mode 44 | # config.threadsafe! 45 | 46 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 47 | # the I18n.default_locale when a translation can not be found) 48 | config.i18n.fallbacks = true 49 | 50 | # Send deprecation notices to registered listeners 51 | config.active_support.deprecation = :notify 52 | end 53 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Configure static asset server for tests with Cache-Control for performance 11 | config.serve_static_assets = true 12 | config.static_cache_control = "public, max-age=3600" 13 | 14 | # Log error messages when you accidentally call methods on nil 15 | config.whiny_nils = true 16 | 17 | # Show full error reports and disable caching 18 | config.consider_all_requests_local = true 19 | config.action_controller.perform_caching = false 20 | 21 | # Raise exceptions instead of rendering exception templates 22 | config.action_dispatch.show_exceptions = false 23 | 24 | # Disable request forgery protection in test environment 25 | config.action_controller.allow_forgery_protection = false 26 | 27 | # Tell Action Mailer not to deliver emails to the real world. 28 | # The :test delivery method accumulates sent emails in the 29 | # ActionMailer::Base.deliveries array. 30 | config.action_mailer.delivery_method = :test 31 | 32 | # Use SQL instead of Active Record's schema dumper when creating the test database. 33 | # This is necessary if your schema can't be completely dumped by the schema dumper, 34 | # like if you have constraints or database-specific column types 35 | # config.active_record.schema_format = :sql 36 | 37 | # Print deprecation notices to the stderr 38 | config.active_support.deprecation = :stderr 39 | end 40 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/generators.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.generators do |g| 2 | end 3 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/omniauth.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.middleware.use OmniAuth::Builder do 2 | provider :twitter, 'KEY', 'SECRET' 3 | end 4 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | Rails3MongoidOmniauth::Application.config.secret_token = 'ce0c9e90903f6dea6f661a8ee8edbd5f4bee4428a4c9ba10e255efd63846b23908537c1a07903cb11ac8cd1fadaa639141450ae7880b22b9bffbbfeffb514d80' 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails3MongoidOmniauth::Application.config.session_store :cookie_store, :key => '_rails3-mongoid-omniauth_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Rails3MongoidOmniauth::Application.config.session_store :active_record_store 9 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | # 3 | # This file contains the settings for ActionController::ParametersWrapper 4 | # which will be enabled by default in the upcoming version of Ruby on Rails. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActionController::Base.wrap_parameters format: [:json] 8 | 9 | # Disable root element in JSON by default. 10 | if defined?(ActiveRecord) 11 | ActiveRecord::Base.include_root_in_json = false 12 | end 13 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /config/mongoid.yml: -------------------------------------------------------------------------------- 1 | development: 2 | host: localhost 3 | database: testapp_development 4 | 5 | test: 6 | host: localhost 7 | database: testapp_test 8 | 9 | # set these environment variables on your prod server 10 | production: 11 | host: <%= ENV['MONGOID_HOST'] %> 12 | port: <%= ENV['MONGOID_PORT'] %> 13 | username: <%= ENV['MONGOID_USERNAME'] %> 14 | password: <%= ENV['MONGOID_PASSWORD'] %> 15 | database: <%= ENV['MONGOID_DATABASE'] %> 16 | # slaves: 17 | # - host: slave1.local 18 | # port: 27018 19 | # - host: slave2.local 20 | # port: 27019 21 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails3MongoidOmniauth::Application.routes.draw do 2 | #get \"users\/show\" 3 | 4 | root :to => "home#index" 5 | 6 | resources :users, :only => [ :show, :edit, :update ] 7 | 8 | match '/auth/:provider/callback' => 'sessions#create' 9 | 10 | match '/signin' => 'sessions#new', :as => :signin 11 | 12 | match '/signout' => 'sessions#destroy', :as => :signout 13 | 14 | match '/auth/failure' => 'sessions#failure' 15 | 16 | # The priority is based upon order of creation: 17 | # first created -> highest priority. 18 | 19 | # Sample of regular route: 20 | # match 'products/:id' => 'catalog#view' 21 | # Keep in mind you can assign values other than :controller and :action 22 | 23 | # Sample of named route: 24 | # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase 25 | # This route can be invoked with purchase_url(:id => product.id) 26 | 27 | # Sample resource route (maps HTTP verbs to controller actions automatically): 28 | # resources :products 29 | 30 | # Sample resource route with options: 31 | # resources :products do 32 | # member do 33 | # get 'short' 34 | # post 'toggle' 35 | # end 36 | # 37 | # collection do 38 | # get 'sold' 39 | # end 40 | # end 41 | 42 | # Sample resource route with sub-resources: 43 | # resources :products do 44 | # resources :comments, :sales 45 | # resource :seller 46 | # end 47 | 48 | # Sample resource route with more complex sub-resources 49 | # resources :products do 50 | # resources :comments 51 | # resources :sales do 52 | # get 'recent', :on => :collection 53 | # end 54 | # end 55 | 56 | # Sample resource route within a namespace: 57 | # namespace :admin do 58 | # # Directs /admin/products/* to Admin::ProductsController 59 | # # (app/controllers/admin/products_controller.rb) 60 | # resources :products 61 | # end 62 | 63 | # You can have the root of your site routed with "root" 64 | # just remember to delete public/index.html. 65 | # root :to => 'welcome#index' 66 | 67 | # See how all your routes lay out with "rake routes" 68 | 69 | # This is a legacy wild controller route that's not recommended for RESTful applications. 70 | # Note: This route will make all actions in every controller accessible via GET requests. 71 | # match ':controller(/:action(/:id(.:format)))' 72 | end 73 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | puts 'EMPTY THE MONGODB DATABASE' 9 | Mongoid.master.collections.reject { |c| c.name =~ /^system/}.each(&:drop) 10 | -------------------------------------------------------------------------------- /features/step_definitions/web_steps.rb: -------------------------------------------------------------------------------- 1 | # TL;DR: YOU SHOULD DELETE THIS FILE 2 | # 3 | # This file was generated by Cucumber-Rails and is only here to get you a head start 4 | # These step definitions are thin wrappers around the Capybara/Webrat API that lets you 5 | # visit pages, interact with widgets and make assertions about page content. 6 | # 7 | # If you use these step definitions as basis for your features you will quickly end up 8 | # with features that are: 9 | # 10 | # * Hard to maintain 11 | # * Verbose to read 12 | # 13 | # A much better approach is to write your own higher level step definitions, following 14 | # the advice in the following blog posts: 15 | # 16 | # * http://benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories.html 17 | # * http://dannorth.net/2011/01/31/whose-domain-is-it-anyway/ 18 | # * http://elabs.se/blog/15-you-re-cuking-it-wrong 19 | # 20 | 21 | 22 | require 'uri' 23 | require 'cgi' 24 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths")) 25 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "selectors")) 26 | 27 | module WithinHelpers 28 | def with_scope(locator) 29 | locator ? within(*selector_for(locator)) { yield } : yield 30 | end 31 | end 32 | World(WithinHelpers) 33 | 34 | # Single-line step scoper 35 | When /^(.*) within (.*[^:])$/ do |step, parent| 36 | with_scope(parent) { When step } 37 | end 38 | 39 | # Multi-line step scoper 40 | When /^(.*) within (.*[^:]):$/ do |step, parent, table_or_string| 41 | with_scope(parent) { When "#{step}:", table_or_string } 42 | end 43 | 44 | Given /^(?:|I )am on (.+)$/ do |page_name| 45 | visit path_to(page_name) 46 | end 47 | 48 | When /^(?:|I )go to (.+)$/ do |page_name| 49 | visit path_to(page_name) 50 | end 51 | 52 | When /^(?:|I )press "([^"]*)"$/ do |button| 53 | click_button(button) 54 | end 55 | 56 | When /^(?:|I )follow "([^"]*)"$/ do |link| 57 | click_link(link) 58 | end 59 | 60 | When /^(?:|I )fill in "([^"]*)" with "([^"]*)"$/ do |field, value| 61 | fill_in(field, :with => value) 62 | end 63 | 64 | When /^(?:|I )fill in "([^"]*)" for "([^"]*)"$/ do |value, field| 65 | fill_in(field, :with => value) 66 | end 67 | 68 | # Use this to fill in an entire form with data from a table. Example: 69 | # 70 | # When I fill in the following: 71 | # | Account Number | 5002 | 72 | # | Expiry date | 2009-11-01 | 73 | # | Note | Nice guy | 74 | # | Wants Email? | | 75 | # 76 | # TODO: Add support for checkbox, select og option 77 | # based on naming conventions. 78 | # 79 | When /^(?:|I )fill in the following:$/ do |fields| 80 | fields.rows_hash.each do |name, value| 81 | When %{I fill in "#{name}" with "#{value}"} 82 | end 83 | end 84 | 85 | When /^(?:|I )select "([^"]*)" from "([^"]*)"$/ do |value, field| 86 | select(value, :from => field) 87 | end 88 | 89 | When /^(?:|I )check "([^"]*)"$/ do |field| 90 | check(field) 91 | end 92 | 93 | When /^(?:|I )uncheck "([^"]*)"$/ do |field| 94 | uncheck(field) 95 | end 96 | 97 | When /^(?:|I )choose "([^"]*)"$/ do |field| 98 | choose(field) 99 | end 100 | 101 | When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field| 102 | attach_file(field, File.expand_path(path)) 103 | end 104 | 105 | Then /^(?:|I )should see "([^"]*)"$/ do |text| 106 | if page.respond_to? :should 107 | page.should have_content(text) 108 | else 109 | assert page.has_content?(text) 110 | end 111 | end 112 | 113 | Then /^(?:|I )should see \/([^\/]*)\/$/ do |regexp| 114 | regexp = Regexp.new(regexp) 115 | 116 | if page.respond_to? :should 117 | page.should have_xpath('//*', :text => regexp) 118 | else 119 | assert page.has_xpath?('//*', :text => regexp) 120 | end 121 | end 122 | 123 | Then /^(?:|I )should not see "([^"]*)"$/ do |text| 124 | if page.respond_to? :should 125 | page.should have_no_content(text) 126 | else 127 | assert page.has_no_content?(text) 128 | end 129 | end 130 | 131 | Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp| 132 | regexp = Regexp.new(regexp) 133 | 134 | if page.respond_to? :should 135 | page.should have_no_xpath('//*', :text => regexp) 136 | else 137 | assert page.has_no_xpath?('//*', :text => regexp) 138 | end 139 | end 140 | 141 | Then /^the "([^"]*)" field(?: within (.*))? should contain "([^"]*)"$/ do |field, parent, value| 142 | with_scope(parent) do 143 | field = find_field(field) 144 | field_value = (field.tag_name == 'textarea') ? field.text : field.value 145 | if field_value.respond_to? :should 146 | field_value.should =~ /#{value}/ 147 | else 148 | assert_match(/#{value}/, field_value) 149 | end 150 | end 151 | end 152 | 153 | Then /^the "([^"]*)" field(?: within (.*))? should not contain "([^"]*)"$/ do |field, parent, value| 154 | with_scope(parent) do 155 | field = find_field(field) 156 | field_value = (field.tag_name == 'textarea') ? field.text : field.value 157 | if field_value.respond_to? :should_not 158 | field_value.should_not =~ /#{value}/ 159 | else 160 | assert_no_match(/#{value}/, field_value) 161 | end 162 | end 163 | end 164 | 165 | Then /^the "([^"]*)" checkbox(?: within (.*))? should be checked$/ do |label, parent| 166 | with_scope(parent) do 167 | field_checked = find_field(label)['checked'] 168 | if field_checked.respond_to? :should 169 | field_checked.should be_true 170 | else 171 | assert field_checked 172 | end 173 | end 174 | end 175 | 176 | Then /^the "([^"]*)" checkbox(?: within (.*))? should not be checked$/ do |label, parent| 177 | with_scope(parent) do 178 | field_checked = find_field(label)['checked'] 179 | if field_checked.respond_to? :should 180 | field_checked.should be_false 181 | else 182 | assert !field_checked 183 | end 184 | end 185 | end 186 | 187 | Then /^(?:|I )should be on (.+)$/ do |page_name| 188 | current_path = URI.parse(current_url).path 189 | if current_path.respond_to? :should 190 | current_path.should == path_to(page_name) 191 | else 192 | assert_equal path_to(page_name), current_path 193 | end 194 | end 195 | 196 | Then /^(?:|I )should have the following query string:$/ do |expected_pairs| 197 | query = URI.parse(current_url).query 198 | actual_params = query ? CGI.parse(query) : {} 199 | expected_params = {} 200 | expected_pairs.rows_hash.each_pair{|k,v| expected_params[k] = v.split(',')} 201 | 202 | if actual_params.respond_to? :should 203 | actual_params.should == expected_params 204 | else 205 | assert_equal expected_params, actual_params 206 | end 207 | end 208 | 209 | Then /^show me the page$/ do 210 | save_and_open_page 211 | end 212 | -------------------------------------------------------------------------------- /features/support/env.rb: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | require 'cucumber/rails' 8 | 9 | # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In 10 | # order to ease the transition to Capybara we set the default here. If you'd 11 | # prefer to use XPath just remove this line and adjust any selectors in your 12 | # steps to use the XPath syntax. 13 | Capybara.default_selector = :css 14 | 15 | # By default, any exception happening in your Rails application will bubble up 16 | # to Cucumber so that your scenario will fail. This is a different from how 17 | # your application behaves in the production environment, where an error page will 18 | # be rendered instead. 19 | # 20 | # Sometimes we want to override this default behaviour and allow Rails to rescue 21 | # exceptions and display an error page (just like when the app is running in production). 22 | # Typical scenarios where you want to do this is when you test your error pages. 23 | # There are two ways to allow Rails to rescue exceptions: 24 | # 25 | # 1) Tag your scenario (or feature) with @allow-rescue 26 | # 27 | # 2) Set the value below to true. Beware that doing this globally is not 28 | # recommended as it will mask a lot of errors for you! 29 | # 30 | ActionController::Base.allow_rescue = false 31 | 32 | # Remove/comment out the lines below if your app doesn't have a database. 33 | # For some databases (like MongoDB and CouchDB) you may need to use :truncation instead. 34 | begin 35 | DatabaseCleaner.orm = 'mongoid' 36 | DatabaseCleaner.strategy = :truncation 37 | rescue NameError 38 | raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." 39 | end 40 | 41 | # You may also want to configure DatabaseCleaner to use different strategies for certain features and scenarios. 42 | # See the DatabaseCleaner documentation for details. Example: 43 | # 44 | # Before('@no-txn,@selenium,@culerity,@celerity,@javascript') do 45 | # DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]} 46 | # end 47 | # 48 | # Before('~@no-txn', '~@selenium', '~@culerity', '~@celerity', '~@javascript') do 49 | # DatabaseCleaner.strategy = :truncation 50 | # end 51 | # 52 | -------------------------------------------------------------------------------- /features/support/paths.rb: -------------------------------------------------------------------------------- 1 | module NavigationHelpers 2 | # Maps a name to a path. Used by the 3 | # 4 | # When /^I go to (.+)$/ do |page_name| 5 | # 6 | # step definition in web_steps.rb 7 | # 8 | def path_to(page_name) 9 | case page_name 10 | 11 | when /^the home\s?page$/ 12 | '/' 13 | 14 | # Add more mappings here. 15 | # Here is an example that pulls values out of the Regexp: 16 | # 17 | # when /^(.*)'s profile page$/i 18 | # user_profile_path(User.find_by_login($1)) 19 | 20 | else 21 | begin 22 | page_name =~ /^the (.*) page$/ 23 | path_components = $1.split(/\s+/) 24 | self.send(path_components.push('path').join('_').to_sym) 25 | rescue NoMethodError, ArgumentError 26 | raise "Can't find mapping from \"#{page_name}\" to a path.\n" + 27 | "Now, go and add a mapping in #{__FILE__}" 28 | end 29 | end 30 | end 31 | end 32 | 33 | World(NavigationHelpers) 34 | -------------------------------------------------------------------------------- /features/support/selectors.rb: -------------------------------------------------------------------------------- 1 | module HtmlSelectorsHelpers 2 | # Maps a name to a selector. Used primarily by the 3 | # 4 | # When /^(.+) within (.+)$/ do |step, scope| 5 | # 6 | # step definitions in web_steps.rb 7 | # 8 | def selector_for(locator) 9 | case locator 10 | 11 | when "the page" 12 | "html > body" 13 | 14 | # Add more mappings here. 15 | # Here is an example that pulls values out of the Regexp: 16 | # 17 | # when /^the (notice|error|info) flash$/ 18 | # ".flash.#{$1}" 19 | 20 | # You can also return an array to use a different selector 21 | # type, like: 22 | # 23 | # when /the header/ 24 | # [:xpath, "//header"] 25 | 26 | # This allows you to provide a quoted selector as the scope 27 | # for "within" steps as was previously the default for the 28 | # web steps: 29 | when /^"(.+)"$/ 30 | $1 31 | 32 | else 33 | raise "Can't find mapping from \"#{locator}\" to a selector.\n" + 34 | "Now, go and add a mapping in #{__FILE__}" 35 | end 36 | end 37 | end 38 | 39 | World(HtmlSelectorsHelpers) 40 | -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edshadi/rails3-mongoid-omniauth/0410d77d25a0b894065d6a608f373b1dac4a7103/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /lib/tasks/cucumber.rake: -------------------------------------------------------------------------------- 1 | # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril. 2 | # It is recommended to regenerate this file in the future when you upgrade to a 3 | # newer version of cucumber-rails. Consider adding your own code to a new file 4 | # instead of editing this one. Cucumber will automatically load all features/**/*.rb 5 | # files. 6 | 7 | 8 | unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks 9 | 10 | vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first 11 | $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil? 12 | 13 | begin 14 | require 'cucumber/rake/task' 15 | 16 | namespace :cucumber do 17 | Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t| 18 | t.binary = vendored_cucumber_bin # If nil, the gem's binary is used. 19 | t.fork = true # You may get faster startup if you set this to false 20 | t.profile = 'default' 21 | end 22 | 23 | Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t| 24 | t.binary = vendored_cucumber_bin 25 | t.fork = true # You may get faster startup if you set this to false 26 | t.profile = 'wip' 27 | end 28 | 29 | Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t| 30 | t.binary = vendored_cucumber_bin 31 | t.fork = true # You may get faster startup if you set this to false 32 | t.profile = 'rerun' 33 | end 34 | 35 | desc 'Run all features' 36 | task :all => [:ok, :wip] 37 | end 38 | desc 'Alias for cucumber:ok' 39 | task :cucumber => 'cucumber:ok' 40 | 41 | task :default => :cucumber 42 | 43 | task :features => :cucumber do 44 | STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***" 45 | end 46 | 47 | # In case we don't have ActiveRecord, append a no-op task that we can depend upon. 48 | task 'db:test:prepare' do 49 | end 50 | rescue LoadError 51 | desc 'cucumber rake task not available (cucumber not installed)' 52 | task :cucumber do 53 | abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin' 54 | end 55 | end 56 | 57 | end 58 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |You may have mistyped the address or the page may have moved.
24 |Maybe you tried to change something you didn't have access to.
24 |We've been notified about this issue and we'll take a look at it shortly.
24 |