forest_liana 1.5.14 → 1.5.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/forest_liana/devise_controller.rb +21 -0
- data/app/deserializers/forest_liana/resource_deserializer.rb +0 -16
- data/app/serializers/forest_liana/serializer_factory.rb +0 -7
- data/app/services/forest_liana/schema_adapter.rb +8 -4
- data/config/routes.rb +3 -0
- data/lib/forest_liana/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eec3956d85afc9b46ed0697de7a7a9039c3d807
|
4
|
+
data.tar.gz: 473b55820c4e679027c17d2ebdfd815d16aed7fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08acb56896bdef9cf219f257557ff4d49e5145b785d539791bd3f37c85537be86d9284d63618b7cc6eb023825140b0d69be597b1b0c37ad05c17d96c9fa8a41d
|
7
|
+
data.tar.gz: 81a4c96ce9796ae5346ffc9a5b23fdda55088381b022401cd440c0fb00449e9f6bc6a60235266c6aaf075eccbc5ea6bf5ee28a922d81b7ce0d94a13af2b544de
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ForestLiana
|
2
|
+
class DeviseController < ForestLiana::ApplicationController
|
3
|
+
def change_password
|
4
|
+
resource = SchemaUtils.find_model_from_table_name(
|
5
|
+
params.dig('data', 'attributes', 'collection_name'))
|
6
|
+
|
7
|
+
user = resource.find(params.dig('data', 'attributes', 'ids').first)
|
8
|
+
user.password = params.dig('data', 'attributes', 'values', 'New password')
|
9
|
+
user.save
|
10
|
+
|
11
|
+
if user.valid?
|
12
|
+
head :no_content
|
13
|
+
else
|
14
|
+
render status: 400, json: {
|
15
|
+
error: user.errors.try(:messages).try(:[], :password)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -16,7 +16,6 @@ module ForestLiana
|
|
16
16
|
extract_paperclip
|
17
17
|
extract_carrierwave
|
18
18
|
extract_acts_as_taggable
|
19
|
-
extract_devise
|
20
19
|
|
21
20
|
@attributes
|
22
21
|
end
|
@@ -114,17 +113,6 @@ module ForestLiana
|
|
114
113
|
end
|
115
114
|
end
|
116
115
|
|
117
|
-
def extract_devise
|
118
|
-
return if @params['data']['attributes'].blank?
|
119
|
-
return unless has_devise?
|
120
|
-
|
121
|
-
if @params['data']['attributes']['password'] == '**********'
|
122
|
-
@params['data']['attributes'].delete('password')
|
123
|
-
else
|
124
|
-
@attributes['password'] = @params['data']['attributes']['password']
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
116
|
def paperclip_handler?(attr)
|
129
117
|
begin
|
130
118
|
Paperclip.io_adapters.handler_for(attr)
|
@@ -165,9 +153,5 @@ module ForestLiana
|
|
165
153
|
@resource.respond_to?(:acts_as_taggable) &&
|
166
154
|
@resource.acts_as_taggable.respond_to?(:to_a)
|
167
155
|
end
|
168
|
-
|
169
|
-
def has_devise?
|
170
|
-
@resource.respond_to?(:devise_modules?)
|
171
|
-
end
|
172
156
|
end
|
173
157
|
end
|
@@ -203,13 +203,6 @@ module ForestLiana
|
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
|
-
# NOTICE: Format Devise attributes
|
207
|
-
if active_record_class.respond_to?(:devise_modules?)
|
208
|
-
serializer.attribute('password') do |x|
|
209
|
-
'**********'
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
206
|
SchemaUtils.associations(active_record_class).each do |a|
|
214
207
|
begin
|
215
208
|
if SchemaUtils.model_included?(a.klass)
|
@@ -28,10 +28,14 @@ module ForestLiana
|
|
28
28
|
|
29
29
|
# NOTICE: Add Devise fields
|
30
30
|
if @model.respond_to?(:devise_modules?)
|
31
|
-
collection.
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
collection.actions << ForestLiana::Model::Action.new({
|
32
|
+
id: "#{collection.name}.Change password",
|
33
|
+
name: "Change password",
|
34
|
+
fields: [{
|
35
|
+
field: 'New password',
|
36
|
+
type: 'String'
|
37
|
+
}]
|
38
|
+
})
|
35
39
|
|
36
40
|
collection.fields.delete_if do |f|
|
37
41
|
['encrypted_password'].include?(f[:field])
|
data/config/routes.rb
CHANGED
@@ -37,4 +37,7 @@ ForestLiana::Engine.routes.draw do
|
|
37
37
|
# Intercom Integration
|
38
38
|
get ':collection/:id/intercom_conversations' => 'intercom#user_conversations'
|
39
39
|
get ':collection/:id/intercom_attributes' => 'intercom#attributes'
|
40
|
+
|
41
|
+
# Devise support
|
42
|
+
post '/actions/change-password' => 'devise#change_password'
|
40
43
|
end
|
data/lib/forest_liana/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forest_liana
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sandro Munda
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- app/controllers/forest_liana/apimaps_controller.rb
|
140
140
|
- app/controllers/forest_liana/application_controller.rb
|
141
141
|
- app/controllers/forest_liana/associations_controller.rb
|
142
|
+
- app/controllers/forest_liana/devise_controller.rb
|
142
143
|
- app/controllers/forest_liana/intercom_controller.rb
|
143
144
|
- app/controllers/forest_liana/resources_controller.rb
|
144
145
|
- app/controllers/forest_liana/router.rb
|