i18n-edit 0.9.2 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/i18n/edit/edit_controller.rb +7 -6
- data/lib/i18n/edit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 628be4a04ebb1cab1eb828f01f67791f651325df
|
4
|
+
data.tar.gz: 854ff9dce5032c479ba40f896c2eaf2f0fade727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a86fc9ce828f03557ccee243b1092bf19c48b618e7226a01660a6de90cd64e3a92852531523d671c03ad19e9f724958c3b1861c240fb683e1146b33c8a791f09
|
7
|
+
data.tar.gz: 9c95f325951a550166ab0277974a0d6347d61d40af4d711f805e39e342c7f4f147a2092d19c7e3a51a50d285f332f494d546f61b704907ac6517fda5ed60f59d
|
@@ -6,7 +6,7 @@ module I18n::Edit
|
|
6
6
|
class EditController < ApplicationController
|
7
7
|
private
|
8
8
|
skip_before_action :verify_authenticity_token
|
9
|
-
|
9
|
+
before_action :security_check
|
10
10
|
|
11
11
|
def self.traverse(key_locations, path, prefix, h)
|
12
12
|
h.each do |key, value|
|
@@ -64,7 +64,7 @@ module I18n::Edit
|
|
64
64
|
"the old text from the browser is #{old_text.inspect}, they don't match. " \
|
65
65
|
'Refusing to write with inconsistent data. ' \
|
66
66
|
"Your edit wasn't written.", layout: false, status: 201
|
67
|
-
return false
|
67
|
+
return false
|
68
68
|
end
|
69
69
|
container[hashes_path[-1]] = text
|
70
70
|
new_file_path = path + '.i18n_edit_new'
|
@@ -78,17 +78,18 @@ module I18n::Edit
|
|
78
78
|
end
|
79
79
|
File.link(path, old_file_path)
|
80
80
|
File.rename(new_file_path, path)
|
81
|
-
return true
|
81
|
+
return true
|
82
82
|
end
|
83
83
|
|
84
84
|
protected
|
85
85
|
def security_check
|
86
86
|
if ENV['I18N_EDIT'].nil?
|
87
|
-
render plain: "I18_EDIT is not set in the environment.", status: 201
|
88
|
-
|
87
|
+
render plain: "I18_EDIT is not set in the environment.", status: 201
|
88
|
+
return false
|
89
89
|
elsif !token_valid?(params)
|
90
|
-
|
90
|
+
return false
|
91
91
|
end
|
92
|
+
return true
|
92
93
|
end
|
93
94
|
|
94
95
|
public
|
data/lib/i18n/edit/version.rb
CHANGED