devise_invitable 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of devise_invitable might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 961c147ada964a1dd6c4c41729e727a85137461b48073d2969c40ef288a269d2
|
4
|
+
data.tar.gz: 5d3d7f9ed3ac1293f0f3d94b16765e295f4fc9650181e972c966547d1cc801d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad864222c8edabededd48a8cc88cc4651fb2e2601d7dfe83f9e5137e9ec987026777ee51ead0a079114e88f958e26c633a84105747c73b034204b20f600911a3
|
7
|
+
data.tar.gz: 07824a77343de171fd3d82c3f415171bf82ff8fac27c38af215b5eb37ff5b90d0ae04edcc1d3a75b23966c1256033c6ef19946af86ecb322c3b4f08820444cb7
|
data/CHANGELOG.md
CHANGED
data/README.rdoc
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
= DeviseInvitable
|
2
|
-
{<img src="https://badge.fury.io/rb/devise_invitable.svg"/>}[http://badge.fury.io/rb/devise_invitable] {<img src="https://travis-ci.org/scambra/devise_invitable.
|
2
|
+
{<img src="https://badge.fury.io/rb/devise_invitable.svg"/>}[http://badge.fury.io/rb/devise_invitable] {<img src="https://travis-ci.org/scambra/devise_invitable.svg"/>}[https://travis-ci.org/scambra/devise_invitable] {<img src="https://codeclimate.com/github/scambra/devise_invitable/badges/gpa.svg"/>}[https://codeclimate.com/github/scambra/devise_invitable]
|
3
3
|
|
4
4
|
It adds support to Devise[https://github.com/plataformatec/devise] for sending invitations by email (it requires to be authenticated) and accept the invitation setting the password.
|
5
5
|
|
@@ -234,8 +234,8 @@ If you want to create the invitation but not send it, you can set <tt>skip_invit
|
|
234
234
|
end
|
235
235
|
# => the record will be created, but the invitation email will not be sent
|
236
236
|
|
237
|
-
When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt
|
238
|
-
|
237
|
+
When generating the <tt>accept_user_invitation_url</tt> yourself, you must use the <tt>raw_invitation_token</tt>.
|
238
|
+
This value is temporarily available when you invite a user and will be decrypted when received.
|
239
239
|
|
240
240
|
accept_user_invitation_url(invitation_token: user.raw_invitation_token)
|
241
241
|
|
@@ -308,7 +308,7 @@ A pair of scopes to find those users that have accepted, and those that have not
|
|
308
308
|
|
309
309
|
== Integration in a Rails application
|
310
310
|
|
311
|
-
Since the invitations controller
|
311
|
+
Since the invitations controller takes care of all the creation/acceptation of an invitation, in most cases you wouldn't call the <tt>invite!</tt> and <tt>accept_invitation!</tt> methods directly.
|
312
312
|
Instead, in your views, put a link to <tt>new_user_invitation_path</tt> or <tt>new_invitation_path(:user)</tt> or even <tt>/users/invitation/new</tt> to prepare and send an invitation (to a user in this example).
|
313
313
|
|
314
314
|
After an invitation is created and sent, the inviter will be redirected to <tt>after_invite_path_for(inviter, invitee)</tt>, which is the same path as <tt>signed_in_root_path</tt> by default.
|
@@ -317,7 +317,7 @@ After an invitation is accepted, the invitee will be redirected to <tt>after_acc
|
|
317
317
|
|
318
318
|
The invitation email includes a link to accept the invitation that looks like this: <tt>/users/invitation/accept?invitation_token=abcd123</tt>. When clicked, the invited must set a password in order to accept its invitation. Note that if the <tt>invitation_token</tt> is not present or not valid, the invited is redirected to <tt>after_sign_out_path_for(resource_name)</tt>.
|
319
319
|
|
320
|
-
The controller sets the <tt>invited_by_id</tt> attribute for the new user to the current user. This will let you easily keep track of who invited
|
320
|
+
The controller sets the <tt>invited_by_id</tt> attribute for the new user to the current user. This will let you easily keep track of who invited whom.
|
321
321
|
|
322
322
|
== Controller filter
|
323
323
|
|
@@ -54,6 +54,7 @@ class Devise::InvitationsController < DeviseController
|
|
54
54
|
if resource.class.allow_insecure_sign_in_after_accept
|
55
55
|
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
|
56
56
|
set_flash_message :notice, flash_message if is_flashing_format?
|
57
|
+
resource.after_database_authentication
|
57
58
|
sign_in(resource_name, resource)
|
58
59
|
respond_with resource, location: after_accept_path_for(resource)
|
59
60
|
else
|
@@ -45,7 +45,7 @@ module Devise
|
|
45
45
|
elsif defined?(Mongoid) && defined?(Mongoid::Document) && self < Mongoid::Document && Mongoid::VERSION >= '6.0.0'
|
46
46
|
belongs_to_options.merge! optional: true
|
47
47
|
end
|
48
|
-
belongs_to :invited_by, belongs_to_options
|
48
|
+
belongs_to :invited_by, **belongs_to_options
|
49
49
|
|
50
50
|
extend ActiveModel::Callbacks
|
51
51
|
define_model_callbacks :invitation_created
|
@@ -0,0 +1,9 @@
|
|
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
|
+
if Rails.version < '5.2.0'
|
8
|
+
RailsApp::Application.config.secret_token = 'e997edf9d7eba5cf89a76a046fa53f5d66261d22cfcf29e3f538c75ad2d175b106bd5d099f44f6ce34ad3b3162d71cfaa37d2d4f4b38645288331427b4c2a607'
|
9
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_invitable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Cambra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- test/rails_app/config/initializers/devise.rb
|
132
132
|
- test/rails_app/config/initializers/inflections.rb
|
133
133
|
- test/rails_app/config/initializers/mime_types.rb
|
134
|
+
- test/rails_app/config/initializers/secret_token.rb
|
134
135
|
- test/rails_app/config/initializers/session_store.rb
|
135
136
|
- test/rails_app/config/initializers/wrap_parameters.rb
|
136
137
|
- test/rails_app/config/locales/devise.en.yml
|
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
168
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.7.
|
169
|
+
rubygems_version: 2.7.9
|
169
170
|
signing_key:
|
170
171
|
specification_version: 4
|
171
172
|
summary: An invitation strategy for Devise
|
@@ -212,6 +213,7 @@ test_files:
|
|
212
213
|
- test/rails_app/config/initializers/devise.rb
|
213
214
|
- test/rails_app/config/initializers/inflections.rb
|
214
215
|
- test/rails_app/config/initializers/mime_types.rb
|
216
|
+
- test/rails_app/config/initializers/secret_token.rb
|
215
217
|
- test/rails_app/config/initializers/session_store.rb
|
216
218
|
- test/rails_app/config/initializers/wrap_parameters.rb
|
217
219
|
- test/rails_app/config/locales/devise.en.yml
|