passwordless 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 482e11575373d9175f46bb4ad1d70bbad5297de2b9e732a84db9051a5ea493b9
4
- data.tar.gz: 578348c9d8ea9dcac2eba8576ee0f110f698c519247882c39abe1e7c420a41a6
3
+ metadata.gz: 1f03719e6034346b778069e91f121cbbc2eac0622e31595ef07a056cb0ac3301
4
+ data.tar.gz: ea42e801a9a60d28f75a16ca17c9d42027c34d7f3d761514a4705d24950c02e7
5
5
  SHA512:
6
- metadata.gz: e82a891d207b39e8b6dd3641f9091a7f16c082947ebb787b25bcd126135cade72f6a098405dc424c73e16431a6ded7f97f55ef2298a870bdcf01698f97083347
7
- data.tar.gz: 01d409c746efa765165947fd7bf83dd15371ac55559fa881535242fcab12b333bb9d7bce1a50c3d6eb2ef0fac3bd8e3d52dbf9a9d3719ca22bf6ff4dc0cb14a7
6
+ metadata.gz: b6a9779ad51b363c0f9341abb88045d337f6acaee8dc2dd32c565bd2ecdac5608d1686e5bbf1e498b5db15a3cd435147fb4353af60027e191f1b7ea4454975e3
7
+ data.tar.gz: 0ff640ef5688934b062cc1678df6ab858bc35bb02389f2e20f9e1fbccfbbb6aadcafea4ae0d05a64e5901876103df701d7db9519ec359bc9465588c61a16c4b3
data/README.md CHANGED
@@ -162,7 +162,7 @@ class ApplicationController < ActionController::Base
162
162
 
163
163
  def require_user!
164
164
  return if current_user
165
- save_passwordless_redirect_location! # <-- here we go!
165
+ save_passwordless_redirect_location!(User) # <-- here we go!
166
166
  redirect_to root_path, flash: {error: 'You are not worthy!'}
167
167
  end
168
168
  end
@@ -43,7 +43,7 @@ module Passwordless
43
43
  sign_in session.authenticatable
44
44
 
45
45
  enabled = Passwordless.redirect_back_after_sign_in
46
- destination = dest = reset_passwordless_redirect_location!
46
+ destination = dest = reset_passwordless_redirect_location!(User)
47
47
 
48
48
  if enabled && destination
49
49
  redirect_to dest
@@ -20,16 +20,20 @@ module Passwordless
20
20
  cookies.delete(key)
21
21
  end
22
22
 
23
- def save_passwordless_redirect_location!
24
- session[:destination_when_rejected] = request.original_url
23
+ def save_passwordless_redirect_location!(authenticatable_class)
24
+ session[session_key(authenticatable_class)] = request.original_url
25
25
  end
26
26
 
27
- def reset_passwordless_redirect_location!
28
- session.delete :destination_when_rejected
27
+ def reset_passwordless_redirect_location!(authenticatable_class)
28
+ session.delete session_key(authenticatable_class)
29
29
  end
30
30
 
31
31
  private
32
32
 
33
+ def session_key(authenticatable_class)
34
+ :"passwordless_prev_location--#{authenticatable_class}"
35
+ end
36
+
33
37
  def cookie_name(authenticatable_class)
34
38
  :"#{authenticatable_class.to_s.underscore}_id"
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module Passwordless
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passwordless
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikkel Malmberg