inboxes 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -1
- data/.rspec +1 -0
- data/README.md +16 -8
- data/Rakefile +4 -0
- data/app/controllers/inboxes/base_controller.rb +0 -6
- data/app/controllers/inboxes/discussions_controller.rb +5 -22
- data/app/controllers/inboxes/messages_controller.rb +0 -9
- data/app/controllers/inboxes/speakers_controller.rb +0 -2
- data/app/helpers/inboxes_helper.rb +1 -2
- data/app/models/discussion.rb +0 -2
- data/config/locales/en.yml +1 -1
- data/config/locales/ru.yml +1 -1
- data/inboxes.gemspec +7 -5
- data/lib/inboxes.rb +2 -4
- data/lib/inboxes/engine.rb +0 -7
- data/lib/inboxes/railtie.rb +0 -1
- data/lib/inboxes/version.rb +1 -1
- data/spec/devise_config.rb +210 -0
- data/spec/fake_app.rb +97 -0
- data/spec/fake_gem.rb +6 -0
- data/spec/inboxes/discussion_spec.rb +104 -0
- data/spec/inboxes/discussions_controller_spec.rb +96 -0
- data/spec/inboxes/discussions_routing_spec.rb +23 -0
- data/spec/inboxes/message_spec.rb +27 -0
- data/spec/inboxes/messages_controller_spec.rb +42 -0
- data/spec/inboxes/speaker_spec.rb +16 -0
- data/spec/inboxes/speakers_controller_spec.rb +72 -0
- data/spec/inboxes_spec.rb +0 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/factories.rb +23 -0
- metadata +172 -37
- data/app/models/inboxes/ability.rb +0 -38
- data/lib/inboxes/ability.rb +0 -29
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@ Inboxes is a young messaging system for Rails app. It:
|
|
5
5
|
- provides 3 models for developers: Discussion, Message and Speaker
|
6
6
|
- read/unread discussions counter
|
7
7
|
- any user can be invited to discussion by the member of this discussion, so you can chat with unlimited number of users
|
8
|
+
- have configurable behavior via CanCan Ability
|
8
9
|
|
9
10
|
##Upgrading from 0.1 to current version (0.2)
|
10
11
|
|
@@ -13,7 +14,6 @@ Inboxes is a young messaging system for Rails app. It:
|
|
13
14
|
##Requirements and recommendations
|
14
15
|
|
15
16
|
Inboxes requires Rails 3.x and [Devise](https://github.com/plataformatec/devise) for user identification (surely, messaging system is not possible without users). Now the gem is tested only with Ruby 1.8.7 and REE.
|
16
|
-
|
17
17
|
We recommend to use Inboxes with [Faye](https://github.com/jcoglan/faye), because it's really sexy with it.
|
18
18
|
|
19
19
|
Remember that unfortunately, Inboxes reserve 3 resources names: Discussion, Message and Speaker.
|
@@ -22,12 +22,21 @@ Since version 0.2.0, it is possible to add `has_inboxes` option to any model. Fo
|
|
22
22
|
|
23
23
|
##Installation
|
24
24
|
|
25
|
-
*Make sure that Devise
|
25
|
+
*Make sure that [Devise](https://github.com/plataformatec/devise) and [CanCan](https://github.com/ryanb/cancan) are already installed and configured in your app!*
|
26
26
|
|
27
|
-
1. Add `gem "inboxes", "~> 0.
|
27
|
+
1. Add `gem "inboxes", "~> 0.2.0"` to the `Gemfile` and run `bundle install`
|
28
28
|
2. Execute `rails generate inboxes:install`. This command will generate migration for messaging system. Don't forget to run migrations: `rake db:migrate`
|
29
29
|
3. Add `has_inboxes` to your User model like [here](https://gist.github.com/1330080).
|
30
|
-
4.
|
30
|
+
4. Add CanCan abilities to manage Inboxes models:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
can [:index, :create], Discussion
|
34
|
+
can :read, Discussion do |discussion|
|
35
|
+
discussion.can_participate?(user)
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
5. Now Inboxes are ready to use. Open `http://yoursite.dev/discussions` to see the list of discussions. You can start new one.
|
31
40
|
|
32
41
|
Default Inboxes views are ugly, so you can copy into your app and make anything with them: `rails generate inboxes:views`
|
33
42
|
If you have problems with installation, you can check [code of demo app](https://github.com/kirs/inboxes-app)
|
@@ -55,8 +64,8 @@ config.inboxes.faye_port = 9292 # 9292 by default
|
|
55
64
|
|
56
65
|
5. Faye installation is finished. If you have any troubles, check the [example app](https://github.com/kirs/inboxes-app/)
|
57
66
|
|
58
|
-
*While
|
59
|
-
You can read more about
|
67
|
+
*While running Inboxes with Faye, don't forget to run Faye worker it: `rackup faye.ru -s thin -E production`*
|
68
|
+
You can read more about that on it's [official page](http://faye.jcoglan.com/).
|
60
69
|
|
61
70
|
### Hints
|
62
71
|
|
@@ -64,8 +73,7 @@ You can read more about Faye on it's [official page](http://faye.jcoglan.com/).
|
|
64
73
|
|
65
74
|
##Todo
|
66
75
|
|
67
|
-
-
|
68
|
-
- Add ability to inherit Inboxes controllers
|
76
|
+
- Finalize RSpec tests (are located in [rspec branch](https://github.com/evrone/inboxes/tree/rspec))
|
69
77
|
- Add Pusher capability
|
70
78
|
- Email notifications and the ability to answer received emails like in Github issues (#7)
|
71
79
|
|
data/Rakefile
CHANGED
@@ -4,10 +4,4 @@ class Inboxes::BaseController < ApplicationController
|
|
4
4
|
def init_discussion
|
5
5
|
@discussion = Discussion.find(params[:discussion_id])
|
6
6
|
end
|
7
|
-
|
8
|
-
# Needs to be overriden so that we use Spree's Ability rather than anyone else's.
|
9
|
-
def current_ability
|
10
|
-
# raise "Loading Ability"
|
11
|
-
@current_ability ||= Inboxes::Ability.new(current_user)
|
12
|
-
end
|
13
7
|
end
|
@@ -1,31 +1,20 @@
|
|
1
1
|
class Inboxes::DiscussionsController < Inboxes::BaseController
|
2
2
|
load_and_authorize_resource
|
3
|
-
# before_filter :authenticate_user!
|
4
|
-
# before_filter :init_and_check_permissions, :only => :show
|
5
3
|
before_filter :load_and_check_discussion_recipient, :only => [:create, :new]
|
6
4
|
|
7
5
|
def index
|
8
6
|
@discussions = current_user.discussions
|
9
7
|
end
|
10
|
-
|
11
|
-
# GET /discussions/1
|
12
|
-
# GET /discussions/1.json
|
8
|
+
|
13
9
|
def show
|
14
|
-
# @discussion = Discussion.includes(:messages, :speakers).find(params[:id])
|
15
10
|
@discussion.mark_as_read_for(current_user)
|
16
11
|
end
|
17
|
-
|
18
|
-
# GET /discussions/new
|
19
|
-
# GET /discussions/new.json
|
12
|
+
|
20
13
|
def new
|
21
|
-
# @discussion = Discussion.new
|
22
14
|
@discussion.messages.build
|
23
15
|
end
|
24
16
|
|
25
|
-
# POST /discussions
|
26
|
-
# POST /discussions.json
|
27
17
|
def create
|
28
|
-
# @discussion = Discussion.new(params[:discussion])
|
29
18
|
@discussion.add_recipient_token current_user.id
|
30
19
|
|
31
20
|
@discussion.messages.each do |m|
|
@@ -41,16 +30,10 @@ class Inboxes::DiscussionsController < Inboxes::BaseController
|
|
41
30
|
end
|
42
31
|
|
43
32
|
private
|
44
|
-
|
45
|
-
# def init_and_check_permissions
|
46
|
-
# @discussion = Discussion.includes(:messages, :speakers).find(params[:id])
|
47
|
-
# redirect_to discussions_url, :notice => t("inboxes.discussions.can_not_participate") unless @discussion.can_participate?(current_user)
|
48
|
-
# end
|
49
|
-
|
33
|
+
|
50
34
|
def load_and_check_discussion_recipient
|
51
35
|
# initializing model for new and create actions
|
52
36
|
@discussion = Discussion.new(params[:discussion].presence || {})
|
53
|
-
# @discussion.recipient_tokens = params[:recipients] if params[:recipients] # pre-population
|
54
37
|
|
55
38
|
# checking if discussion with this user already exists
|
56
39
|
if @discussion.recipient_ids && @discussion.recipient_ids.size == 1
|
@@ -61,8 +44,8 @@ class Inboxes::DiscussionsController < Inboxes::BaseController
|
|
61
44
|
@discussion.messages.each do |message|
|
62
45
|
Message.create(:discussion => discussion, :user => current_user, :body => message.body) if message.body
|
63
46
|
end
|
64
|
-
#
|
65
|
-
redirect_to discussion_url(discussion), :notice => t("inboxes.discussions.
|
47
|
+
# redirecting to that existing object
|
48
|
+
redirect_to discussion_url(discussion), :notice => t("inboxes.discussions.already_exists", :user => user[Inboxes::config.user_name])
|
66
49
|
end
|
67
50
|
end
|
68
51
|
end
|
@@ -1,6 +1,4 @@
|
|
1
1
|
class Inboxes::MessagesController < Inboxes::BaseController
|
2
|
-
# before_filter :init_discussion
|
3
|
-
# load_and_authorize_resource
|
4
2
|
load_and_authorize_resource :discussion
|
5
3
|
load_resource :message, :through => :discussion, :shallow => true
|
6
4
|
|
@@ -14,11 +12,4 @@ class Inboxes::MessagesController < Inboxes::BaseController
|
|
14
12
|
format.js
|
15
13
|
end
|
16
14
|
end
|
17
|
-
|
18
|
-
# private
|
19
|
-
#
|
20
|
-
# def init_and_check_permissions
|
21
|
-
# @discussion = Discussion.find(params[:discussion_id])
|
22
|
-
# redirect_to discussions_url, :notice => t("inboxes.discussions.can_not_participate") unless @discussion.can_participate?(current_user)
|
23
|
-
# end
|
24
15
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class Inboxes::SpeakersController < Inboxes::BaseController
|
2
|
-
# before_filter :init_discussion
|
3
2
|
load_and_authorize_resource :discussion
|
4
3
|
load_resource :speaker, :through => :discussion, :shallow => true
|
5
|
-
# load_and_authorize_resource
|
6
4
|
|
7
5
|
def create
|
8
6
|
raise ActiveRecord::RecordNotFound unless params[:speaker] && params[:speaker][:user_id]
|
@@ -3,7 +3,6 @@ module InboxesHelper
|
|
3
3
|
def inboxes_faye_broadcast(channel, &block)
|
4
4
|
message = {:channel => channel, :data => capture(&block), :ext => {:auth_token => defined?(FAYE_TOKEN) ? FAYE_TOKEN : ""}}
|
5
5
|
uri = URI.parse("http://#{Inboxes::config.faye_host}:#{Inboxes::config.faye_port}/faye")
|
6
|
-
|
7
|
-
res = Net::HTTP.post_form(uri, :message => message.to_json)
|
6
|
+
resource = Net::HTTP.post_form(uri, :message => message.to_json)
|
8
7
|
end
|
9
8
|
end
|
data/app/models/discussion.rb
CHANGED
data/config/locales/en.yml
CHANGED
@@ -10,6 +10,6 @@ en:
|
|
10
10
|
discussions:
|
11
11
|
started: "Discussion started"
|
12
12
|
leaved: "You leave the discussion"
|
13
|
-
|
13
|
+
already_exists: "Discussion between you and %{user} already exists"
|
14
14
|
can_not_participate: "You are not listed in this discussion"
|
15
15
|
choose_at_least_one_recipient: "You should choose at least one recipient of discussion"
|
data/config/locales/ru.yml
CHANGED
@@ -9,7 +9,7 @@ ru:
|
|
9
9
|
discussions:
|
10
10
|
started: "Чат начат"
|
11
11
|
leaved: "Вы покинули дискуссию"
|
12
|
-
|
12
|
+
already_exists: "Дискуссия между вами и %{user} уже существует"
|
13
13
|
can_not_participate: "Вы не состоите в этой дискуссии"
|
14
14
|
choose_at_least_one_recipient: "Укажите хотя бы одного получателя"
|
15
15
|
speakers:
|
data/inboxes.gemspec
CHANGED
@@ -21,12 +21,14 @@ Gem::Specification.new do |s|
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
# s.add_development_dependency "ruby-debug"
|
23
23
|
s.add_runtime_dependency "haml-rails"
|
24
|
-
s.add_runtime_dependency "
|
25
|
-
|
24
|
+
s.add_runtime_dependency "devise"
|
25
|
+
s.add_runtime_dependency "rails"
|
26
|
+
s.add_runtime_dependency "cancan"
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
s.add_development_dependency "sqlite3"
|
29
|
+
s.add_development_dependency 'rspec', ['>= 0']
|
30
|
+
s.add_development_dependency 'factory_girl', ['~> 1.2']
|
31
|
+
s.add_development_dependency 'rspec-rails', ['>= 0']
|
30
32
|
# s.add_development_dependency 'rr', ['>= 0']
|
31
33
|
# s.add_development_dependency 'steak', ['>= 0']
|
32
34
|
# s.add_development_dependency 'capybara', ['>= 0']
|
data/lib/inboxes.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
+
require "cancan"
|
1
2
|
require "inboxes/version"
|
2
3
|
require "inboxes/railtie"
|
3
|
-
require "inboxes/ability"
|
4
4
|
require "inboxes/engine"
|
5
5
|
require "inboxes/active_record_extension"
|
6
|
-
|
6
|
+
require "cancan"
|
7
7
|
|
8
8
|
module Inboxes
|
9
|
-
|
10
9
|
def self.configure(&block)
|
11
10
|
yield @config ||= Inboxes::Configuration.new
|
12
11
|
end
|
@@ -31,5 +30,4 @@ module Inboxes
|
|
31
30
|
|
32
31
|
# adding method inboxes for models
|
33
32
|
ActiveRecord::Base.extend(Inboxes::ActiveRecordExtension)
|
34
|
-
|
35
33
|
end
|
data/lib/inboxes/engine.rb
CHANGED
data/lib/inboxes/railtie.rb
CHANGED
data/lib/inboxes/version.rb
CHANGED
@@ -0,0 +1,210 @@
|
|
1
|
+
# Use this hook to configure devise mailer, warden hooks and so forth. The first
|
2
|
+
# four configuration values can also be set straight in your models.
|
3
|
+
Devise.setup do |config|
|
4
|
+
# ==> Mailer Configuration
|
5
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
6
|
+
# note that it will be overwritten if you use your own mailer class with default "from" parameter.
|
7
|
+
config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
|
8
|
+
|
9
|
+
# Configure the class responsible to send e-mails.
|
10
|
+
# config.mailer = "Devise::Mailer"
|
11
|
+
|
12
|
+
# ==> ORM configuration
|
13
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
14
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
15
|
+
# available as additional gems.
|
16
|
+
require 'devise/orm/active_record'
|
17
|
+
|
18
|
+
# ==> Configuration for any authentication mechanism
|
19
|
+
# Configure which keys are used when authenticating a user. The default is
|
20
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
21
|
+
# authenticating a user, both parameters are required. Remember that those
|
22
|
+
# parameters are used only when authenticating and not when retrieving from
|
23
|
+
# session. If you need permissions, you should implement that in a before filter.
|
24
|
+
# You can also supply a hash where the value is a boolean determining whether
|
25
|
+
# or not authentication should be aborted when the value is not present.
|
26
|
+
# config.authentication_keys = [ :email ]
|
27
|
+
|
28
|
+
# Configure parameters from the request object used for authentication. Each entry
|
29
|
+
# given should be a request method and it will automatically be passed to the
|
30
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
31
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
32
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
33
|
+
# config.request_keys = []
|
34
|
+
|
35
|
+
# Configure which authentication keys should be case-insensitive.
|
36
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
37
|
+
# to authenticate or find a user. Default is :email.
|
38
|
+
config.case_insensitive_keys = [ :email ]
|
39
|
+
|
40
|
+
# Configure which authentication keys should have whitespace stripped.
|
41
|
+
# These keys will have whitespace before and after removed upon creating or
|
42
|
+
# modifying a user and when used to authenticate or find a user. Default is :email.
|
43
|
+
config.strip_whitespace_keys = [ :email ]
|
44
|
+
|
45
|
+
# Tell if authentication through request.params is enabled. True by default.
|
46
|
+
# config.params_authenticatable = true
|
47
|
+
|
48
|
+
# Tell if authentication through HTTP Basic Auth is enabled. False by default.
|
49
|
+
# config.http_authenticatable = false
|
50
|
+
|
51
|
+
# If http headers should be returned for AJAX requests. True by default.
|
52
|
+
# config.http_authenticatable_on_xhr = true
|
53
|
+
|
54
|
+
# The realm used in Http Basic Authentication. "Application" by default.
|
55
|
+
# config.http_authentication_realm = "Application"
|
56
|
+
|
57
|
+
# It will change confirmation, password recovery and other workflows
|
58
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
59
|
+
# Does not affect registerable.
|
60
|
+
# config.paranoid = true
|
61
|
+
|
62
|
+
# ==> Configuration for :database_authenticatable
|
63
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
64
|
+
# using other encryptors, it sets how many times you want the password re-encrypted.
|
65
|
+
#
|
66
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
67
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
68
|
+
# a value less than 10 in other environments.
|
69
|
+
config.stretches = Rails.env.test? ? 1 : 10
|
70
|
+
|
71
|
+
# Setup a pepper to generate the encrypted password.
|
72
|
+
# config.pepper = "9a86f39fcb72573a367c4fcde09b1ae3fe81c3c2c5858c6024033360b39a0f46ab72c8aade6453e96dfae546262c0336372c19518600367fc8b94e9bb4d5db15"
|
73
|
+
|
74
|
+
# ==> Configuration for :confirmable
|
75
|
+
# A period that the user is allowed to access the website even without
|
76
|
+
# confirming his account. For instance, if set to 2.days, the user will be
|
77
|
+
# able to access the website for two days without confirming his account,
|
78
|
+
# access will be blocked just in the third day. Default is 0.days, meaning
|
79
|
+
# the user cannot access the website without confirming his account.
|
80
|
+
# config.confirm_within = 2.days
|
81
|
+
|
82
|
+
# Defines which key will be used when confirming an account
|
83
|
+
# config.confirmation_keys = [ :email ]
|
84
|
+
|
85
|
+
# ==> Configuration for :rememberable
|
86
|
+
# The time the user will be remembered without asking for credentials again.
|
87
|
+
# config.remember_for = 2.weeks
|
88
|
+
|
89
|
+
# If true, a valid remember token can be re-used between multiple browsers.
|
90
|
+
# config.remember_across_browsers = true
|
91
|
+
|
92
|
+
# If true, extends the user's remember period when remembered via cookie.
|
93
|
+
# config.extend_remember_period = false
|
94
|
+
|
95
|
+
# If true, uses the password salt as remember token. This should be turned
|
96
|
+
# to false if you are not using database authenticatable.
|
97
|
+
config.use_salt_as_remember_token = true
|
98
|
+
|
99
|
+
# Options to be passed to the created cookie. For instance, you can set
|
100
|
+
# :secure => true in order to force SSL only cookies.
|
101
|
+
# config.cookie_options = {}
|
102
|
+
|
103
|
+
# ==> Configuration for :validatable
|
104
|
+
# Range for password length. Default is 6..128.
|
105
|
+
# config.password_length = 6..128
|
106
|
+
|
107
|
+
# Email regex used to validate email formats. It simply asserts that
|
108
|
+
# an one (and only one) @ exists in the given string. This is mainly
|
109
|
+
# to give user feedback and not to assert the e-mail validity.
|
110
|
+
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
111
|
+
|
112
|
+
# ==> Configuration for :timeoutable
|
113
|
+
# The time you want to timeout the user session without activity. After this
|
114
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
115
|
+
# config.timeout_in = 30.minutes
|
116
|
+
|
117
|
+
# ==> Configuration for :lockable
|
118
|
+
# Defines which strategy will be used to lock an account.
|
119
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
120
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
121
|
+
# config.lock_strategy = :failed_attempts
|
122
|
+
|
123
|
+
# Defines which key will be used when locking and unlocking an account
|
124
|
+
# config.unlock_keys = [ :email ]
|
125
|
+
|
126
|
+
# Defines which strategy will be used to unlock an account.
|
127
|
+
# :email = Sends an unlock link to the user email
|
128
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
129
|
+
# :both = Enables both strategies
|
130
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
131
|
+
# config.unlock_strategy = :both
|
132
|
+
|
133
|
+
# Number of authentication tries before locking an account if lock_strategy
|
134
|
+
# is failed attempts.
|
135
|
+
# config.maximum_attempts = 20
|
136
|
+
|
137
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
138
|
+
# config.unlock_in = 1.hour
|
139
|
+
|
140
|
+
# ==> Configuration for :recoverable
|
141
|
+
#
|
142
|
+
# Defines which key will be used when recovering the password for an account
|
143
|
+
# config.reset_password_keys = [ :email ]
|
144
|
+
|
145
|
+
# Time interval you can reset your password with a reset password key.
|
146
|
+
# Don't put a too small interval or your users won't have the time to
|
147
|
+
# change their passwords.
|
148
|
+
config.reset_password_within = 2.hours
|
149
|
+
|
150
|
+
# ==> Configuration for :encryptable
|
151
|
+
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
152
|
+
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
153
|
+
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
154
|
+
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
155
|
+
# REST_AUTH_SITE_KEY to pepper)
|
156
|
+
# config.encryptor = :sha512
|
157
|
+
|
158
|
+
# ==> Configuration for :token_authenticatable
|
159
|
+
# Defines name of the authentication token params key
|
160
|
+
# config.token_authentication_key = :auth_token
|
161
|
+
|
162
|
+
# If true, authentication through token does not store user in session and needs
|
163
|
+
# to be supplied on each request. Useful if you are using the token as API token.
|
164
|
+
# config.stateless_token = false
|
165
|
+
|
166
|
+
# ==> Scopes configuration
|
167
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
168
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
169
|
+
# are using only default views.
|
170
|
+
# config.scoped_views = false
|
171
|
+
|
172
|
+
# Configure the default scope given to Warden. By default it's the first
|
173
|
+
# devise role declared in your routes (usually :user).
|
174
|
+
# config.default_scope = :user
|
175
|
+
|
176
|
+
# Configure sign_out behavior.
|
177
|
+
# Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
|
178
|
+
# The default is true, which means any logout action will sign out all active scopes.
|
179
|
+
# config.sign_out_all_scopes = true
|
180
|
+
|
181
|
+
# ==> Navigation configuration
|
182
|
+
# Lists the formats that should be treated as navigational. Formats like
|
183
|
+
# :html, should redirect to the sign in page when the user does not have
|
184
|
+
# access, but formats like :xml or :json, should return 401.
|
185
|
+
#
|
186
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
187
|
+
# should add them to the navigational formats lists.
|
188
|
+
#
|
189
|
+
# The :"*/*" and "*/*" formats below is required to match Internet
|
190
|
+
# Explorer requests.
|
191
|
+
# config.navigational_formats = [:"*/*", "*/*", :html]
|
192
|
+
|
193
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
194
|
+
config.sign_out_via = :delete
|
195
|
+
|
196
|
+
# ==> OmniAuth
|
197
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
198
|
+
# up on your models and hooks.
|
199
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
|
200
|
+
|
201
|
+
# ==> Warden configuration
|
202
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
203
|
+
# change the failure app, you can configure them inside the config.warden block.
|
204
|
+
#
|
205
|
+
# config.warden do |manager|
|
206
|
+
# manager.failure_app = AnotherApp
|
207
|
+
# manager.intercept_401 = false
|
208
|
+
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
|
209
|
+
# end
|
210
|
+
end
|