dailycred 0.1.461 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +2 -2
- data/README.md +43 -15
- data/Rakefile +2 -2
- data/app/controllers/sessions_controller.rb +1 -1
- data/app/views/sessions/info.html.erb +2 -2
- data/config/routes.rb +4 -4
- data/dailycred.gemspec +1 -1
- data/dummy-preauth/.gitignore +16 -0
- data/dummy-preauth/Gemfile +42 -0
- data/dummy-preauth/README.rdoc +28 -0
- data/dummy-preauth/Rakefile +6 -0
- data/dummy-preauth/app/assets/images/rails.png +0 -0
- data/dummy-preauth/app/assets/javascripts/application.js +16 -0
- data/{dummy/app/assets/javascripts/posts.js.coffee → dummy-preauth/app/assets/javascripts/welcome.js.coffee} +1 -1
- data/dummy-preauth/app/assets/stylesheets/application.css +13 -0
- data/{dummy/app/assets/stylesheets/posts.css.scss → dummy-preauth/app/assets/stylesheets/welcome.css.scss} +1 -1
- data/dummy-preauth/app/controllers/application_controller.rb +6 -0
- data/{dummy/app/mailers/.gitkeep → dummy-preauth/app/controllers/concerns/.keep} +0 -0
- data/dummy-preauth/app/controllers/sessions_controller.rb +34 -0
- data/dummy-preauth/app/controllers/users_controller.rb +30 -0
- data/dummy-preauth/app/controllers/welcome_controller.rb +9 -0
- data/dummy-preauth/app/helpers/application_helper.rb +2 -0
- data/dummy-preauth/app/helpers/sessions_helper.rb +2 -0
- data/dummy-preauth/app/helpers/users_helper.rb +2 -0
- data/dummy-preauth/app/helpers/welcome_helper.rb +2 -0
- data/{dummy/app/models/.gitkeep → dummy-preauth/app/mailers/.keep} +0 -0
- data/{dummy/lib/assets/.gitkeep → dummy-preauth/app/models/.keep} +0 -0
- data/{dummy/lib/tasks/.gitkeep → dummy-preauth/app/models/concerns/.keep} +0 -0
- data/dummy-preauth/app/models/user.rb +34 -0
- data/dummy-preauth/app/views/layouts/application.html.erb +14 -0
- data/dummy-preauth/app/views/sessions/new.html.erb +15 -0
- data/dummy-preauth/app/views/users/_form.html.erb +20 -0
- data/dummy-preauth/app/views/users/edit.html.erb +3 -0
- data/dummy-preauth/app/views/users/new.html.erb +5 -0
- data/dummy-preauth/app/views/welcome/index.html.erb +2 -0
- data/dummy-preauth/bin/bundle +3 -0
- data/dummy-preauth/bin/rails +4 -0
- data/dummy-preauth/bin/rake +4 -0
- data/dummy-preauth/config.ru +4 -0
- data/dummy-preauth/config/application.rb +22 -0
- data/dummy-preauth/config/boot.rb +4 -0
- data/dummy-preauth/config/database.yml +25 -0
- data/dummy-preauth/config/environment.rb +5 -0
- data/dummy-preauth/config/environments/development.rb +27 -0
- data/dummy-preauth/config/environments/production.rb +80 -0
- data/dummy-preauth/config/environments/test.rb +36 -0
- data/dummy-preauth/config/initializers/backtrace_silencers.rb +7 -0
- data/dummy-preauth/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy-preauth/config/initializers/inflections.rb +16 -0
- data/dummy-preauth/config/initializers/mime_types.rb +5 -0
- data/dummy-preauth/config/initializers/omniauth.rb +9 -0
- data/dummy-preauth/config/initializers/secret_token.rb +12 -0
- data/dummy-preauth/config/initializers/session_store.rb +3 -0
- data/dummy-preauth/config/initializers/wrap_parameters.rb +14 -0
- data/dummy-preauth/config/locales/en.yml +23 -0
- data/dummy-preauth/config/routes.rb +57 -0
- data/dummy-preauth/db/migrate/20130423011519_create_users.rb +15 -0
- data/dummy-preauth/db/migrate/20130423011738_add_uuid_to_users.rb +5 -0
- data/dummy-preauth/db/schema.rb +26 -0
- data/dummy-preauth/db/seeds.rb +7 -0
- data/{dummy/log/.gitkeep → dummy-preauth/lib/assets/.keep} +0 -0
- data/dummy-preauth/lib/controller_authentication.rb +48 -0
- data/{dummy/test/fixtures/.gitkeep → dummy-preauth/lib/tasks/.keep} +0 -0
- data/{dummy/test/functional/.gitkeep → dummy-preauth/log/.keep} +0 -0
- data/dummy-preauth/public/404.html +27 -0
- data/dummy-preauth/public/422.html +26 -0
- data/dummy-preauth/public/500.html +26 -0
- data/{dummy/test/integration/.gitkeep → dummy-preauth/public/favicon.ico} +0 -0
- data/dummy-preauth/public/robots.txt +5 -0
- data/{dummy/test/unit/.gitkeep → dummy-preauth/test/controllers/.keep} +0 -0
- data/dummy-preauth/test/controllers/welcome_controller_test.rb +9 -0
- data/{dummy/vendor/assets/javascripts/.gitkeep → dummy-preauth/test/fixtures/.keep} +0 -0
- data/dummy-preauth/test/fixtures/users.yml +12 -0
- data/dummy-preauth/test/functional/sessions_controller_test.rb +22 -0
- data/dummy-preauth/test/functional/users_controller_test.rb +51 -0
- data/{dummy/vendor/assets/stylesheets/.gitkeep → dummy-preauth/test/helpers/.keep} +0 -0
- data/dummy-preauth/test/helpers/welcome_helper_test.rb +4 -0
- data/{dummy/vendor/plugins/.gitkeep → dummy-preauth/test/integration/.keep} +0 -0
- data/dummy-preauth/test/mailers/.keep +0 -0
- data/dummy-preauth/test/models/.keep +0 -0
- data/dummy-preauth/test/test_helper.rb +15 -0
- data/dummy-preauth/test/unit/user_test.rb +86 -0
- data/dummy-preauth/vendor/assets/javascripts/.keep +0 -0
- data/dummy-preauth/vendor/assets/stylesheets/.keep +0 -0
- data/dummy/.gitignore +3 -2
- data/dummy/Gemfile +14 -28
- data/dummy/README.rdoc +15 -248
- data/dummy/Rakefile +0 -1
- data/dummy/app/assets/javascripts/application.js +2 -1
- data/dummy/app/controllers/application_controller.rb +5 -4
- data/dummy/app/controllers/concerns/.keep +0 -0
- data/dummy/app/mailers/.keep +0 -0
- data/dummy/app/models/.keep +0 -0
- data/dummy/app/models/concerns/.keep +0 -0
- data/dummy/app/views/layouts/application.html.erb +2 -6
- data/dummy/bin/bundle +3 -0
- data/dummy/bin/rails +4 -0
- data/dummy/bin/rake +4 -0
- data/dummy/config/application.rb +2 -42
- data/dummy/config/boot.rb +0 -2
- data/dummy/config/environment.rb +2 -2
- data/dummy/config/environments/development.rb +9 -19
- data/dummy/config/environments/production.rb +40 -27
- data/dummy/config/environments/test.rb +12 -13
- data/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/dummy/config/initializers/inflections.rb +6 -5
- data/dummy/config/initializers/omniauth.rb +9 -2
- data/dummy/config/initializers/secret_token.rb +6 -1
- data/dummy/config/initializers/session_store.rb +1 -6
- data/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/dummy/config/locales/en.yml +20 -2
- data/dummy/config/routes.rb +15 -26
- data/dummy/db/migrate/{20120925172903_create_users.rb → 20130417131939_create_users.rb} +7 -11
- data/dummy/db/schema.rb +9 -19
- data/dummy/lib/assets/.keep +0 -0
- data/dummy/lib/tasks/.keep +0 -0
- data/dummy/log/.keep +0 -0
- data/dummy/public/404.html +2 -1
- data/dummy/public/422.html +1 -1
- data/dummy/public/500.html +2 -1
- data/dummy/public/robots.txt +1 -1
- data/dummy/test/controllers/.keep +0 -0
- data/dummy/test/fixtures/.keep +0 -0
- data/dummy/test/helpers/.keep +0 -0
- data/dummy/test/integration/.keep +0 -0
- data/dummy/test/mailers/.keep +0 -0
- data/dummy/test/models/.keep +0 -0
- data/dummy/test/test_helper.rb +11 -58
- data/dummy/vendor/assets/javascripts/.keep +0 -0
- data/dummy/vendor/assets/stylesheets/.keep +0 -0
- data/lib/dailycred.rb +2 -2
- data/lib/dailycred/acts_as_dailycred.rb +4 -17
- data/lib/dailycred/client.rb +1 -0
- data/lib/dailycred/engine.rb +3 -2
- data/lib/dailycred/helper.rb +4 -4
- data/lib/dailycred/middleware.rb +5 -2
- data/lib/dailycred/version.rb +1 -1
- data/lib/generators/dailycred_generator.rb +17 -8
- data/lib/generators/templates/migration_create_user.rb +3 -9
- data/lib/omniauth/strategies/dailycred.rb +2 -0
- data/spec/helper_spec.rb +1 -3
- data/test/generator_test.rb +4 -3
- metadata +103 -52
- data/dummy/Guardfile +0 -31
- data/dummy/app/assets/stylesheets/scaffolds.css.scss +0 -69
- data/dummy/app/controllers/posts_controller.rb +0 -86
- data/dummy/app/helpers/posts_helper.rb +0 -2
- data/dummy/app/models/post.rb +0 -3
- data/dummy/app/views/posts/_form.html.erb +0 -21
- data/dummy/app/views/posts/edit.html.erb +0 -6
- data/dummy/app/views/posts/index.html.erb +0 -23
- data/dummy/app/views/posts/new.html.erb +0 -5
- data/dummy/app/views/posts/show.html.erb +0 -10
- data/dummy/db/migrate/20120926012555_create_posts.rb +0 -9
- data/dummy/db/migrate/20121002192037_update_users_2.rb +0 -70
- data/dummy/db/migrate/20121108192739_add_column_to_posts.rb +0 -5
- data/dummy/public/index.html +0 -241
- data/dummy/script/rails +0 -6
- data/dummy/test/fixtures/posts.yml +0 -7
- data/dummy/test/fixtures/users.yml +0 -3
- data/dummy/test/functional/posts_controller_test.rb +0 -51
- data/dummy/test/performance/browsing_test.rb +0 -12
- data/dummy/test/unit/helpers/posts_helper_test.rb +0 -4
- data/dummy/test/unit/post_test.rb +0 -7
- data/dummy/test/unit/user_test.rb +0 -77
- data/spec/omniauth/strategies/dailycred_spec.rb +0 -64
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
!binary "U0hBMQ==":
|
|
3
|
+
metadata.gz: 347a55fb9eae49897183cd5bab9ba6b7316c6215
|
|
4
|
+
data.tar.gz: ca8ce17bab65de8228d0898cc509b8301ed0bed7
|
|
5
|
+
!binary "U0hBNTEy":
|
|
6
|
+
metadata.gz: a463c7d68d9a0264595d7b76a2bf4bf4a1d0ef838c93274630352b96ec8f1f05569d2c0dfebb2a37bc1af43304d735f4a0f302c40f999e225542cef2691a3bdf
|
|
7
|
+
data.tar.gz: f496ca9d9213cef0b0a390bf78865d4d363dbd002aaaafb46be0d6e053bde5fdbd7b93159648c1868d78eba882a1e980aed4e220164a9cb504a71769d8093731
|
data/Gemfile
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
source 'https://rubygems.org'
|
|
2
2
|
|
|
3
3
|
gemspec
|
|
4
|
-
|
|
5
4
|
gem 'rspec'
|
|
6
|
-
gem 'rails'
|
|
5
|
+
gem 'rails', '~> 3.2.12'
|
|
7
6
|
gem 'simplecov'
|
|
8
7
|
gem 'ruby_gntp'
|
|
9
8
|
gem 'growl'
|
|
@@ -16,3 +15,4 @@ gem 'fl-rocco'
|
|
|
16
15
|
gem 'redcarpet', '~> 1.17'
|
|
17
16
|
gem 'markdown'
|
|
18
17
|
gem 'maruku'
|
|
18
|
+
gem 'faraday'
|
data/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
## Ruby on Rails
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
The Dailycred ruby gem is everything you need to get off the ground running with robust authentication. It includes an [omniauth](https://github.com/intridea/omniauth) provider and a generator to create necessary models and controllers. The generated authentication structure is inspired by [nifty-generators](https://github.com/ryanb/nifty-generators).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
If you'd rather only communicate with Dailycred through OAuth and provide your own authentication controllers and models, you can use the [omniauth_dailycred](https://github.com/dailycred/omniauth_dailycred) gem.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
##Installation
|
|
8
|
+
|
|
9
|
+
To get started using Dailycred with Ruby on Rails, the first thing you need to do is add the dailycred gem to your gemfile:
|
|
8
10
|
|
|
9
11
|
gem 'dailycred'
|
|
10
12
|
|
|
@@ -30,21 +32,21 @@ While this is enough to get off the ground running with user authentication, thi
|
|
|
30
32
|
|
|
31
33
|
## Authenticating
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
### login_path
|
|
34
36
|
|
|
35
37
|
A helper for linking to the authentication url.
|
|
36
38
|
|
|
37
39
|
<%= link_to 'sign up', login_path %>
|
|
38
40
|
# => <a href="/auth/dailycred">sign up</a>
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
### logout_path
|
|
41
43
|
|
|
42
44
|
To logout a user, simply send them to `/auth/logout`.
|
|
43
45
|
|
|
44
46
|
<%= link_to 'logout', logout_path %>
|
|
45
47
|
# => <a href="/auth/logout">logout</a>
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
### authenticate
|
|
48
50
|
|
|
49
51
|
To protect a controller method from unauthorized users, use the 'authorize' helper method as a `before_filter`.
|
|
50
52
|
|
|
@@ -111,7 +113,7 @@ You can also connect additional social accounts to an existing user:
|
|
|
111
113
|
|
|
112
114
|
There are a few other helper methods available:
|
|
113
115
|
|
|
114
|
-
|
|
116
|
+
### current_user
|
|
115
117
|
|
|
116
118
|
Returns the current logged in user or nil. Example usage:
|
|
117
119
|
|
|
@@ -119,7 +121,7 @@ Returns the current logged in user or nil. Example usage:
|
|
|
119
121
|
redirect_to :controller => 'welcome', :action => 'thanks'
|
|
120
122
|
end
|
|
121
123
|
|
|
122
|
-
|
|
124
|
+
### dailycred
|
|
123
125
|
|
|
124
126
|
A helper for instantiating a dailycred client instance. Use as a `before_filter` to load a @dailycred instance variable, or just use it as a helper method. Example usage:
|
|
125
127
|
|
|
@@ -137,27 +139,27 @@ or just as a helper
|
|
|
137
139
|
dailycred.event(current_user.uid, "New Task", @task.name)
|
|
138
140
|
end
|
|
139
141
|
|
|
140
|
-
|
|
142
|
+
### Tagging a User
|
|
141
143
|
|
|
142
144
|
Dailycred provides the ability to 'tag' users, whether for reference in analytics or any other reason. Note that this is a very simple 'tagging' system, and not something you should use for dynamic tagging situations in your application.
|
|
143
145
|
|
|
144
146
|
@user.tag 'awesome'
|
|
145
147
|
@user.untag 'awesome'
|
|
146
148
|
|
|
147
|
-
|
|
149
|
+
### Firing Events
|
|
148
150
|
|
|
149
151
|
You can also fire events tied to a specific user - this is helpful for goal tracking and tying actions to a specific user in analytics. We already fire many events for when a user signs up, resets a password, and much more, but you can also use the event system for something more specific for your application.
|
|
150
152
|
|
|
151
153
|
# user#fire_event(key, value)
|
|
152
154
|
@user.fire_event 'task added', @task.name
|
|
153
155
|
|
|
154
|
-
|
|
156
|
+
### Building Referral URLs
|
|
155
157
|
|
|
156
158
|
To easily build referral URLs to track sharing amongst your users, use `referral_link(my_site)`, where *my_site* is the url that you wish referred users to be sent to.
|
|
157
159
|
|
|
158
160
|
current_user.referral_link("http://www.mysite.com")
|
|
159
161
|
|
|
160
|
-
|
|
162
|
+
### Testing Controllers
|
|
161
163
|
|
|
162
164
|
Testing controllers that have the `authenticate` before filter is easy:
|
|
163
165
|
|
|
@@ -166,7 +168,7 @@ Testing controllers that have the `authenticate` before filter is easy:
|
|
|
166
168
|
|
|
167
169
|
See `dummy/test/functional/post_controller_test.rb` for an example.
|
|
168
170
|
|
|
169
|
-
|
|
171
|
+
### Dailycred API
|
|
170
172
|
|
|
171
173
|
For reference, have a look at the [annotated source code.](https://www.dailycred.com/public/docs/ruby/lib/dailycred.html)
|
|
172
174
|
|
|
@@ -181,7 +183,32 @@ Where opts is an optional hash for passing options. After initializing your clie
|
|
|
181
183
|
@dailycred.untag(current_user.uid, "Failed Checkout") # user_id, key
|
|
182
184
|
|
|
183
185
|
|
|
184
|
-
|
|
186
|
+
### Persona Login
|
|
187
|
+
|
|
188
|
+
1. Set your `persona audience` in your [dailycred identity provider settings](https://www.dailycred.com/admin/settings/identity-providers). This will be `http://{your-url}/auth/dailycred/callback`.
|
|
189
|
+
2. Make sure you have configured your `callback url` in your [dailycred app settings](https://www.dailycred.com/admin/settings)
|
|
190
|
+
3. In `config/omniauth.rb`, configure your middleware options to include your persona audience:
|
|
191
|
+
|
|
192
|
+
Rails.configuration.DAILYCRED_OPTIONS = {
|
|
193
|
+
middleware: {
|
|
194
|
+
persona_audience = "http://{your-url}/auth/dailycred/callback"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
4. In your javascript, call `personaLogin()`.
|
|
199
|
+
|
|
200
|
+
$(document).ready(function(){
|
|
201
|
+
$('.persona-login').click(function(){
|
|
202
|
+
personaLogin();
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
5. Your user will be redirected to your [persona.org](https://persona.org) to login. If successful, your user will be redirected to your OAuth callback URL and be logged in.
|
|
207
|
+
|
|
208
|
+
For more details, visit our [persona documentation](https://www.dailycred.com/docs/persona)
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
### Configuration
|
|
185
212
|
|
|
186
213
|
To specify where users should be redirected after authentication actions, setup configure an `after_auth` property on a `Rails.configuration.DAILYCRED_OPTIONS` variable. Example:
|
|
187
214
|
|
|
@@ -202,3 +229,4 @@ To specify where users should be redirected after authentication actions, setup
|
|
|
202
229
|
|
|
203
230
|

|
|
204
231
|
|
|
232
|
+
[](https://travis-ci.org/dailycred/dailycred)
|
data/Rakefile
CHANGED
|
@@ -27,7 +27,7 @@ task :docs do
|
|
|
27
27
|
require 'fileutils'
|
|
28
28
|
require 'maruku'
|
|
29
29
|
Rocco::make 'docs/'
|
|
30
|
-
FileUtils.cp_r "docs/lib/", "/Users/hank/
|
|
30
|
+
FileUtils.cp_r "docs/lib/", "/Users/hank/java/dailycred/public/docs/ruby/", :verbose => true
|
|
31
31
|
md = ""
|
|
32
32
|
File.open("README.md", "r") do |infile|
|
|
33
33
|
while (line = infile.gets)
|
|
@@ -35,7 +35,7 @@ task :docs do
|
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
doc = Maruku.new(md)
|
|
38
|
-
File.open("/Users/hank/
|
|
38
|
+
File.open("/Users/hank/java/dailycred/app/views/tags/docs/rubyonrails.html", 'w') {|f| f.write doc.to_html}
|
|
39
39
|
rescue LoadError
|
|
40
40
|
warn "#$! -- rocco tasks not loaded."
|
|
41
41
|
task :rocco
|
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
<%= link_to 'Log In', login_path() %>
|
|
10
10
|
<br><%= link_to 'connect with facebook', connect_path(:identity_provider => :facebook) %>
|
|
11
11
|
<br><%= link_to 'connect with google', connect_path(:identity_provider => :google) %>
|
|
12
|
-
<br><%= link_to 'connect with twitter',
|
|
13
|
-
<% end %>
|
|
12
|
+
<br><%= link_to 'connect with twitter',connect_path(:identity_provider => :twitter) %>
|
|
13
|
+
<% end %>
|
data/config/routes.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Dailycred::Engine.routes.draw do
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
get "/:provider/callback" => "sessions#create"
|
|
3
|
+
get "/logout" => "sessions#destroy", :as => :logout
|
|
4
|
+
get "/" => "sessions#info", :as => :auth_info
|
|
5
5
|
# get "/dailycred", :as => :login
|
|
6
|
-
|
|
6
|
+
get "/failure" => "sessions#failure"
|
|
7
7
|
end
|
data/dailycred.gemspec
CHANGED
|
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
|
|
|
6
6
|
gem.email = ["hstove@gmail.com"]
|
|
7
7
|
gem.description = %q{A Ruby on Rails engine for authentication with Dailycred.}
|
|
8
8
|
gem.summary = %q{}
|
|
9
|
-
gem.homepage = "https://
|
|
9
|
+
gem.homepage = "https://github.com/dailycred/dailycred"
|
|
10
10
|
gem.add_dependency("omniauth")
|
|
11
11
|
gem.add_dependency("omniauth-oauth2")
|
|
12
12
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
2
|
+
#
|
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
|
6
|
+
|
|
7
|
+
# Ignore bundler config.
|
|
8
|
+
/.bundle
|
|
9
|
+
|
|
10
|
+
# Ignore the default SQLite database.
|
|
11
|
+
/db/*.sqlite3
|
|
12
|
+
/db/*.sqlite3-journal
|
|
13
|
+
|
|
14
|
+
# Ignore all logfiles and tempfiles.
|
|
15
|
+
/log/*.log
|
|
16
|
+
/tmp
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
4
|
+
gem 'rails', '4.0.0.beta1'
|
|
5
|
+
|
|
6
|
+
gem 'sqlite3'
|
|
7
|
+
gem 'dailycred', path: '../'
|
|
8
|
+
gem "nifty-generators", :group => :development
|
|
9
|
+
gem 'protected_attributes'
|
|
10
|
+
# Gems used only for assets and not required
|
|
11
|
+
# in production environments by default.
|
|
12
|
+
group :assets do
|
|
13
|
+
gem 'sass-rails', '~> 4.0.0.beta1'
|
|
14
|
+
gem 'coffee-rails', '~> 4.0.0.beta1'
|
|
15
|
+
|
|
16
|
+
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
|
17
|
+
# gem 'therubyracer', platforms: :ruby
|
|
18
|
+
|
|
19
|
+
gem 'uglifier', '>= 1.0.3'
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
gem 'jquery-rails'
|
|
23
|
+
|
|
24
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
|
25
|
+
gem 'turbolinks'
|
|
26
|
+
|
|
27
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
|
28
|
+
gem 'jbuilder', '~> 1.0.1'
|
|
29
|
+
|
|
30
|
+
# To use ActiveModel has_secure_password
|
|
31
|
+
# gem 'bcrypt-ruby', '~> 3.0.0'
|
|
32
|
+
|
|
33
|
+
# Use unicorn as the app server
|
|
34
|
+
# gem 'unicorn'
|
|
35
|
+
|
|
36
|
+
# Deploy with Capistrano
|
|
37
|
+
# gem 'capistrano', group: :development
|
|
38
|
+
|
|
39
|
+
# To use debugger
|
|
40
|
+
# gem 'debugger'
|
|
41
|
+
|
|
42
|
+
gem "mocha", group: :test
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
|
Binary file
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
|
12
|
+
//
|
|
13
|
+
//= require jquery
|
|
14
|
+
//= require jquery_ujs
|
|
15
|
+
//= require turbolinks
|
|
16
|
+
//= require_tree .
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# Place all the behaviors and hooks related to the matching controller here.
|
|
2
2
|
# All this logic will automatically be available in application.js.
|
|
3
|
-
# You can use CoffeeScript in this file: http://
|
|
3
|
+
# You can use CoffeeScript in this file: http://coffeescript.org/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
|
10
|
+
*
|
|
11
|
+
*= require_self
|
|
12
|
+
*= require_tree .
|
|
13
|
+
*/
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
class SessionsController < ApplicationController
|
|
2
|
+
def new
|
|
3
|
+
end
|
|
4
|
+
|
|
5
|
+
def create
|
|
6
|
+
user = User.authenticate(params[:login], params[:password])
|
|
7
|
+
if user
|
|
8
|
+
session[:user_id] = user.id
|
|
9
|
+
redirect_to_target_or_default root_url, :notice => "Logged in successfully."
|
|
10
|
+
else
|
|
11
|
+
flash.now[:alert] = "Invalid login or password."
|
|
12
|
+
render :action => 'new'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def destroy
|
|
17
|
+
session[:user_id] = nil
|
|
18
|
+
redirect_to root_url, :notice => "You have been logged out."
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def callback
|
|
22
|
+
auth_hash = request.env['omniauth.auth']
|
|
23
|
+
if auth_hash['uid']
|
|
24
|
+
@user = User.find_or_create_by(uuid: auth_hash['uid'])
|
|
25
|
+
@user.uuid = auth_hash['uid']
|
|
26
|
+
@user.save
|
|
27
|
+
session[:user_id] = @user.id
|
|
28
|
+
flash[:notice] = "Logged in successfully."
|
|
29
|
+
else
|
|
30
|
+
flash[:notice] = "There was an error logging you in."
|
|
31
|
+
end
|
|
32
|
+
redirect_to_target_or_default root_url
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class UsersController < ApplicationController
|
|
2
|
+
before_filter :login_required, :except => [:new, :create]
|
|
3
|
+
|
|
4
|
+
def new
|
|
5
|
+
@user = User.new
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def create
|
|
9
|
+
@user = User.new(params[:user])
|
|
10
|
+
if @user.save
|
|
11
|
+
session[:user_id] = @user.id
|
|
12
|
+
redirect_to root_url, :notice => "Thank you for signing up! You are now logged in."
|
|
13
|
+
else
|
|
14
|
+
render :action => 'new'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def edit
|
|
19
|
+
@user = current_user
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def update
|
|
23
|
+
@user = current_user
|
|
24
|
+
if @user.update_attributes(params[:user])
|
|
25
|
+
redirect_to root_url, :notice => "Your profile has been updated."
|
|
26
|
+
else
|
|
27
|
+
render :action => 'edit'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|