userbin 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: a53b7ce5956e924c312988da213d450af0452dd9
4
- data.tar.gz: f23fff56bb22109692e8a56799b3c6a432b2db74
3
+ metadata.gz: ffb33696d1a2f483737a9fa8b0a01e7e128c5f10
4
+ data.tar.gz: bb3e04e484ce61941564925cfc22a17aa851157a
5
5
  SHA512:
6
- metadata.gz: 0285983c3614f68e4072ffa316bf145ea3a3590220c8e517a649c084876b3b78212ef1b687feaac0b443af810b143d2deae74f1d388a9571fcce48b5c16b039d
7
- data.tar.gz: ecc1820bd394efe36441919b64e3de39ebf33b9d10fce94d0581d1d0f8080b8bd619c459447ba62a0ad96d886c7aa74d48e02d900269fa2e62c92ed428ebbe8b
6
+ metadata.gz: fb74e2140435c17f7862de7691965bab6ed7cf486c7f5df408c11be0f233b0aea410880165b8fae9cd369eebb438cf61915682e616cc5a1312d8fb0abf7969e9
7
+ data.tar.gz: 76260d3eac6214681540d5c96ef5eca265737992d6a763f17d5d27db07069f2adde2b05e5773bf81675405f7ce3e063d3c513b7b1f62ff790f8a286dc36162d3
@@ -60,12 +60,6 @@ module Userbin
60
60
  LINK_TAGS
61
61
  end
62
62
 
63
- def meta_tag
64
- <<-META_TAG
65
- <meta property="userbin:events" content="/userbin" />
66
- META_TAG
67
- end
68
-
69
63
  def script_tag
70
64
  script_url = ENV.fetch('USERBIN_SCRIPT_URL') {
71
65
  "https://js.userbin.com"
@@ -97,7 +91,6 @@ module Userbin
97
91
  def inject_tags(body, login_path = restrict)
98
92
  if body[CLOSING_HEAD_TAG]
99
93
  body = body.gsub(CLOSING_HEAD_TAG, link_tags(login_path) + '\\0')
100
- body = body.gsub(CLOSING_HEAD_TAG, meta_tag + '\\0')
101
94
  end
102
95
  if body[CLOSING_BODY_TAG]
103
96
  body = body.gsub(CLOSING_BODY_TAG, script_tag + '\\0')
@@ -2,8 +2,8 @@ module Userbin
2
2
  class Configuration
3
3
  attr_accessor :app_id
4
4
  attr_accessor :api_secret
5
+ attr_accessor :current_user
5
6
  attr_accessor :auto_include_tags
6
- attr_accessor :user_model
7
7
  attr_accessor :restricted_path
8
8
 
9
9
  def initialize
@@ -26,10 +26,6 @@ module Userbin
26
26
  event.object
27
27
  end
28
28
  model = event.instance_exec object, &callback.block
29
-
30
- if event.type =~ /user\.created/ && model.respond_to?(:id)
31
- object.update_local_id(model.id)
32
- end
33
29
  end
34
30
  end
35
31
  end
@@ -1,15 +1,11 @@
1
1
  module Userbin
2
2
  module AuthHelpers
3
- def userbin_current_user
4
- local_id = Userbin.current_user.local_id
5
-
6
- if local_id
7
- user_klass = if Userbin.config.user_model
8
- Userbin.config.user_model.call
9
- else
10
- User
11
- end
12
- @current_user ||= user_klass.find(local_id)
3
+ def current_user
4
+ return unless Userbin.authenticated?
5
+ if Userbin.config.current_user
6
+ @current_user ||= Userbin.config.current_user.call(Userbin.current_user)
7
+ else
8
+ raise "Userbin: No method configured for returning 'current_user'"
13
9
  end
14
10
  end
15
11
  end
@@ -5,12 +5,7 @@ module Userbin
5
5
  include Her::Model
6
6
  end
7
7
 
8
- class User < Model
9
- def update_local_id(local_id)
10
- self.local_id = local_id
11
- save
12
- end
13
- end
8
+ class User < Model; end
14
9
 
15
10
  class Session < Model
16
11
  has_one :user
@@ -19,7 +19,6 @@ module Userbin
19
19
  current = Userbin::Session.new(MultiJson.decode(data))
20
20
 
21
21
  if current.authenticated?
22
- # FIXME: NoMethodError (undefined method `/' for nil:NilClass):
23
22
  if now > Time.at(current.expires_at / 1000)
24
23
  signature, data = refresh_session(current.user.id)
25
24
  end
@@ -1,3 +1,3 @@
1
1
  module Userbin
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: userbin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: Plug n play user accounts. The simplest way to integrate a full authentication
83
+ description: Plug n' play user accounts. The simplest way to integrate a full authentication
84
84
  and user management stack into your web application.
85
85
  email: johan@userbin.com
86
86
  executables: []