middleman-gibberish 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZjY3YWU2OTM4YjE5MDhhZDY4NzRmZjM1ZDkwNTQ2ZTViZDA4ZWRmNA==
4
+ OWMzNGMwYmE2ZTExMzcwYTQ5NmYxMmQ4N2I4ZTc5ZGMwMmMwY2VmNg==
5
5
  data.tar.gz: !binary |-
6
- MDU2NzVkN2VmMGZmMWQ5ODBmMTc1ZTQ1NmFmZGFhMzljOWM4N2Y5Zg==
6
+ NzZmOGFhZjQ0YzA1Yzg1M2YwZDE3ZGJlMzk4YmJiMWJlYTcxYmQ3ZQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjExNWVhZTQyNDllMTdhMzY1NTI1NzI5ZGEwZDRjODM4OWJhOTcxMjM2YmM4
10
- YzQyNWEzNmU4NTcyOTRmZGNkYTRlNTYyODI2NzNhZmNmNWQyMjZhZDMyNjkx
11
- NWEzM2NjNzhlNTA1MzI3OThhNmJmMGQ2ZmI0MWZiYzNhZmI1MzA=
9
+ MGIzNGUzNjRiN2U2NjFmZmI0YTNhYTM3MzIwNmJmY2ZlNTBmYjI0YjY2OGEz
10
+ NDY2YTg5MzZmYjQ3ZDZlYmQ2MmVlMzUxMTQ5ZDc3ZGYyMmU5ODljYmJhZWNj
11
+ MzcwOTczYmE5ODg0YjJjYTMyZWM2ZTkzMmYzYjA1MjZkNzQ5Yjg=
12
12
  data.tar.gz: !binary |-
13
- ODg1YWFiNzlkOGRhYTIwZjBlZTlhOGE5NWU0NmU0YTc4YzkxZWI2Mjk2MzQz
14
- OWZkMjgxOWI5OTA3OGE5YTk5MjA5Y2NmMGQ5OTUxZTgyOGQ3MGQ1ZDQ5Yzk2
15
- OTEwMWNjZTU4MGVmM2FjNGY5NTU3NmZhNGZhZGQ2ZTM2NThiZTk=
13
+ MjY2YTYwNGVhOWEwMmRmZmRkOGUyNWI0NGEyNzU2NDcxNTg0ODMwYWE3NDBk
14
+ YzVkNDAyNDk4YmQ4MDYwMTg3NWVhYjg5NDczZGVmMjQyMzU5ZDI0MjYwZjJm
15
+ NDVkYjBlMDhmNTY1OTMzMDYyOGM2YzUwNGFhNzRlOWIzZTZiYTU=
data/README.md CHANGED
@@ -70,7 +70,7 @@ INSTALL
70
70
 
71
71
  EXAMPLES
72
72
  --------
73
- http://ahoward.github.io/middleman-gibberish/
73
+ http://ahoward.github.io/middleman-gibberish/ (password=gibberish)
74
74
 
75
75
 
76
76
  USAGE
@@ -3,7 +3,7 @@ require 'gibberish'
3
3
 
4
4
  module ::Middleman
5
5
  class Gibberish < Middleman::Extension
6
- Version = '0.5.0'
6
+ Version = '0.6.0'
7
7
 
8
8
  def Gibberish.version
9
9
  Version
@@ -191,7 +191,6 @@ module ::Middleman
191
191
  var cookie = #{ glob.to_json };
192
192
  var options = {path: "/", expires: 1};
193
193
 
194
-
195
194
  jQuery(function(){
196
195
  var password = jQuery('.gibberish-password');
197
196
  var message = jQuery('.gibberish-message');
@@ -199,14 +198,8 @@ module ::Middleman
199
198
  password.focus();
200
199
  message.html('');
201
200
 
202
- password.keyup(function(e){
203
- var code = e.which;
204
-
205
- e.preventDefault();
206
-
207
- var _password = (jQuery.cookie(cookie) || password.val());
208
-
209
- if(code==13 && !_password==""){
201
+ var decrypt = function(_password){
202
+ if(_password){
210
203
  try{
211
204
  var decrypted = GibberishAES.dec(encrypted, _password);
212
205
 
@@ -216,19 +209,38 @@ module ::Middleman
216
209
  jQuery.cookie(cookie, _password, options);
217
210
  } catch(e) {
218
211
  };
212
+
213
+ return true;
219
214
  } catch(e) {
220
215
  try{
221
216
  jQuery.removeCookie(cookie, options);
222
217
  } catch(e) {
223
218
  };
224
- message.html("sorry, wrong password - try again.");
219
+
220
+ return false;
225
221
  };
226
- } else {
227
- message.html("");
228
- };
222
+ }
223
+
224
+ return false;
225
+ };
226
+
227
+ password.keyup(function(e){
228
+ var code = e.which;
229
+ e.preventDefault();
230
+
231
+ if(code==13){
232
+ var _password = password.val();
233
+ if(!decrypt(_password)){
234
+ message.html("sorry, wrong password - try again.");
235
+ }
236
+ }
229
237
 
230
238
  return(false);
231
239
  });
240
+
241
+
242
+ var _password = jQuery.cookie(cookie);
243
+ decrypt(_password);
232
244
  });
233
245
  </script>
234
246
  __
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "middleman-gibberish"
6
- spec.version = "0.5.0"
6
+ spec.version = "0.6.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "middleman-gibberish"
9
9
  spec.description = "password protect middleman pages - even on s3"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: middleman-gibberish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard