jquery-complexify-rails 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2e2b9cec5ceb183e4aa9e34cc245948f564ff974
4
+ data.tar.gz: d73d4981f72eb89aaa7a0739b967d8a7b74dee11
5
+ SHA512:
6
+ metadata.gz: c3b2fa6e49370238814cfcd69e9ff537fad9530d33e3c22236c7d7341c61a94cf80f10e2c2cd1fdc72d9909721be5192633b3c96ba90678a8dc95b5bfd00f5c0
7
+ data.tar.gz: a073cc7e2b6dcd1af0b2a661cd4023bf96539795e7d9bb8ac5172982b9ee232a94e113effad842eb863a9fcd4fac1ac50df36fa76c3b5c9c8cdd7d7c4a6fdf37
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Pablo Lluch
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ = jquery-complexify-rails
2
+
3
+ A gem for integrating the jQuery Complexify plugin with the rails assets pipeline
4
+
5
+ == Contributing to jquery-complexify-rails
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2014 Pablo Lluch. See LICENSE for
18
+ further details.
19
+
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "jquery-complexify-rails"
18
+ gem.homepage = "http://github.com/pelluch/jquery-complexify-rails"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{TODO: one-line summary of your gem}
21
+ gem.description = %Q{TODO: longer description of your gem}
22
+ gem.email = "pablo.lluch@gmail.com"
23
+ gem.authors = ["Pablo Lluch"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ desc "Code coverage detail"
35
+ task :simplecov do
36
+ ENV['COVERAGE'] = "true"
37
+ Rake::Task['spec'].execute
38
+ end
39
+
40
+ task :default => :spec
41
+
42
+ require 'rdoc/task'
43
+ Rake::RDocTask.new do |rdoc|
44
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
+
46
+ rdoc.rdoc_dir = 'rdoc'
47
+ rdoc.title = "jquery-complexify-rails #{version}"
48
+ rdoc.rdoc_files.include('README*')
49
+ rdoc.rdoc_files.include('lib/**/*.rb')
50
+ end
@@ -0,0 +1,3 @@
1
+ // Generated from 500 worst passwords and 370 Banned Twitter lists found at
2
+ // @source http://www.skullsecurity.org/wiki/index.php/Passwords
3
+ COMPLEXIFY_BANLIST = '123456|password|12345678|1234|pussy|12345|dragon|qwerty|696969|mustang|letmein|baseball|master|michael|football|shadow|monkey|abc123|pass|fuckme|6969|jordan|harley|ranger|iwantu|jennifer|hunter|fuck|2000|test|batman|trustno1|thomas|tigger|robert|access|love|buster|1234567|soccer|hockey|killer|george|sexy|andrew|charlie|superman|asshole|fuckyou|dallas|jessica|panties|pepper|1111|austin|william|daniel|golfer|summer|heather|hammer|yankees|joshua|maggie|biteme|enter|ashley|thunder|cowboy|silver|richard|fucker|orange|merlin|michelle|corvette|bigdog|cheese|matthew|121212|patrick|martin|freedom|ginger|blowjob|nicole|sparky|yellow|camaro|secret|dick|falcon|taylor|111111|131313|123123|bitch|hello|scooter|please|porsche|guitar|chelsea|black|diamond|nascar|jackson|cameron|654321|computer|amanda|wizard|xxxxxxxx|money|phoenix|mickey|bailey|knight|iceman|tigers|purple|andrea|horny|dakota|aaaaaa|player|sunshine|morgan|starwars|boomer|cowboys|edward|charles|girls|booboo|coffee|xxxxxx|bulldog|ncc1701|rabbit|peanut|john|johnny|gandalf|spanky|winter|brandy|compaq|carlos|tennis|james|mike|brandon|fender|anthony|blowme|ferrari|cookie|chicken|maverick|chicago|joseph|diablo|sexsex|hardcore|666666|willie|welcome|chris|panther|yamaha|justin|banana|driver|marine|angels|fishing|david|maddog|hooters|wilson|butthead|dennis|fucking|captain|bigdick|chester|smokey|xavier|steven|viking|snoopy|blue|eagles|winner|samantha|house|miller|flower|jack|firebird|butter|united|turtle|steelers|tiffany|zxcvbn|tomcat|golf|bond007|bear|tiger|doctor|gateway|gators|angel|junior|thx1138|porno|badboy|debbie|spider|melissa|booger|1212|flyers|fish|porn|matrix|teens|scooby|jason|walter|cumshot|boston|braves|yankee|lover|barney|victor|tucker|princess|mercedes|5150|doggie|zzzzzz|gunner|horney|bubba|2112|fred|johnson|xxxxx|tits|member|boobs|donald|bigdaddy|bronco|penis|voyager|rangers|birdie|trouble|white|topgun|bigtits|bitches|green|super|qazwsx|magic|lakers|rachel|slayer|scott|2222|asdf|video|london|7777|marlboro|srinivas|internet|action|carter|jasper|monster|teresa|jeremy|11111111|bill|crystal|peter|pussies|cock|beer|rocket|theman|oliver|prince|beach|amateur|7777777|muffin|redsox|star|testing|shannon|murphy|frank|hannah|dave|eagle1|11111|mother|nathan|raiders|steve|forever|angela|viper|ou812|jake|lovers|suckit|gregory|buddy|whatever|young|nicholas|lucky|helpme|jackie|monica|midnight|college|baby|cunt|brian|mark|startrek|sierra|leather|232323|4444|beavis|bigcock|happy|sophie|ladies|naughty|giants|booty|blonde|fucked|golden|0|fire|sandra|pookie|packers|einstein|dolphins|chevy|winston|warrior|sammy|slut|8675309|zxcvbnm|nipples|power|victoria|asdfgh|vagina|toyota|travis|hotdog|paris|rock|xxxx|extreme|redskins|erotic|dirty|ford|freddy|arsenal|access14|wolf|nipple|iloveyou|alex|florida|eric|legend|movie|success|rosebud|jaguar|great|cool|cooper|1313|scorpio|mountain|madison|987654|brazil|lauren|japan|naked|squirt|stars|apple|alexis|aaaa|bonnie|peaches|jasmine|kevin|matt|qwertyui|danielle|beaver|4321|4128|runner|swimming|dolphin|gordon|casper|stupid|shit|saturn|gemini|apples|august|3333|canada|blazer|cumming|hunting|kitty|rainbow|112233|arthur|cream|calvin|shaved|surfer|samson|kelly|paul|mine|king|racing|5555|eagle|hentai|newyork|little|redwings|smith|sticky|cocacola|animal|broncos|private|skippy|marvin|blondes|enjoy|girl|apollo|parker|qwert|time|sydney|women|voodoo|magnum|juice|abgrtyu|777777|dreams|maxwell|music|rush2112|russia|scorpion|rebecca|tester|mistress|phantom|billy|6666|albert|111111|11111111|112233|121212|123123|123456|1234567|12345678|131313|232323|654321|666666|696969|777777|7777777|8675309|987654|abcdef|password1|password12|password123|twitter'.split('|');
@@ -0,0 +1,185 @@
1
+ /*
2
+ http://github.com/danpalmer/jquery.complexify.js
3
+
4
+ This code is distributed under the WTFPL v2:
5
+ */
6
+ (function ($) {
7
+
8
+ $.fn.extend({
9
+ complexify: function(options, callback) {
10
+
11
+ var MIN_COMPLEXITY = 49; // 12 chars with Upper, Lower and Number
12
+ var MAX_COMPLEXITY = 120; // 25 chars, all charsets
13
+ var CHARSETS = [
14
+ // Commonly Used
15
+ ////////////////////
16
+ [0x0030, 0x0039], // Numbers
17
+ [0x0041, 0x005A], // Uppercase
18
+ [0x0061, 0x007A], // Lowercase
19
+ [0x0021, 0x002F], // Punctuation
20
+ [0x003A, 0x0040], // Punctuation
21
+ [0x005B, 0x0060], // Punctuation
22
+ [0x007B, 0x007E], // Punctuation
23
+ // Everything Else
24
+ ////////////////////
25
+ [0x0080, 0x00FF], // Latin-1 Supplement
26
+ [0x0100, 0x017F], // Latin Extended-A
27
+ [0x0180, 0x024F], // Latin Extended-B
28
+ [0x0250, 0x02AF], // IPA Extensions
29
+ [0x02B0, 0x02FF], // Spacing Modifier Letters
30
+ [0x0300, 0x036F], // Combining Diacritical Marks
31
+ [0x0370, 0x03FF], // Greek
32
+ [0x0400, 0x04FF], // Cyrillic
33
+ [0x0530, 0x058F], // Armenian
34
+ [0x0590, 0x05FF], // Hebrew
35
+ [0x0600, 0x06FF], // Arabic
36
+ [0x0700, 0x074F], // Syriac
37
+ [0x0780, 0x07BF], // Thaana
38
+ [0x0900, 0x097F], // Devanagari
39
+ [0x0980, 0x09FF], // Bengali
40
+ [0x0A00, 0x0A7F], // Gurmukhi
41
+ [0x0A80, 0x0AFF], // Gujarati
42
+ [0x0B00, 0x0B7F], // Oriya
43
+ [0x0B80, 0x0BFF], // Tamil
44
+ [0x0C00, 0x0C7F], // Telugu
45
+ [0x0C80, 0x0CFF], // Kannada
46
+ [0x0D00, 0x0D7F], // Malayalam
47
+ [0x0D80, 0x0DFF], // Sinhala
48
+ [0x0E00, 0x0E7F], // Thai
49
+ [0x0E80, 0x0EFF], // Lao
50
+ [0x0F00, 0x0FFF], // Tibetan
51
+ [0x1000, 0x109F], // Myanmar
52
+ [0x10A0, 0x10FF], // Georgian
53
+ [0x1100, 0x11FF], // Hangul Jamo
54
+ [0x1200, 0x137F], // Ethiopic
55
+ [0x13A0, 0x13FF], // Cherokee
56
+ [0x1400, 0x167F], // Unified Canadian Aboriginal Syllabics
57
+ [0x1680, 0x169F], // Ogham
58
+ [0x16A0, 0x16FF], // Runic
59
+ [0x1780, 0x17FF], // Khmer
60
+ [0x1800, 0x18AF], // Mongolian
61
+ [0x1E00, 0x1EFF], // Latin Extended Additional
62
+ [0x1F00, 0x1FFF], // Greek Extended
63
+ [0x2000, 0x206F], // General Punctuation
64
+ [0x2070, 0x209F], // Superscripts and Subscripts
65
+ [0x20A0, 0x20CF], // Currency Symbols
66
+ [0x20D0, 0x20FF], // Combining Marks for Symbols
67
+ [0x2100, 0x214F], // Letterlike Symbols
68
+ [0x2150, 0x218F], // Number Forms
69
+ [0x2190, 0x21FF], // Arrows
70
+ [0x2200, 0x22FF], // Mathematical Operators
71
+ [0x2300, 0x23FF], // Miscellaneous Technical
72
+ [0x2400, 0x243F], // Control Pictures
73
+ [0x2440, 0x245F], // Optical Character Recognition
74
+ [0x2460, 0x24FF], // Enclosed Alphanumerics
75
+ [0x2500, 0x257F], // Box Drawing
76
+ [0x2580, 0x259F], // Block Elements
77
+ [0x25A0, 0x25FF], // Geometric Shapes
78
+ [0x2600, 0x26FF], // Miscellaneous Symbols
79
+ [0x2700, 0x27BF], // Dingbats
80
+ [0x2800, 0x28FF], // Braille Patterns
81
+ [0x2E80, 0x2EFF], // CJK Radicals Supplement
82
+ [0x2F00, 0x2FDF], // Kangxi Radicals
83
+ [0x2FF0, 0x2FFF], // Ideographic Description Characters
84
+ [0x3000, 0x303F], // CJK Symbols and Punctuation
85
+ [0x3040, 0x309F], // Hiragana
86
+ [0x30A0, 0x30FF], // Katakana
87
+ [0x3100, 0x312F], // Bopomofo
88
+ [0x3130, 0x318F], // Hangul Compatibility Jamo
89
+ [0x3190, 0x319F], // Kanbun
90
+ [0x31A0, 0x31BF], // Bopomofo Extended
91
+ [0x3200, 0x32FF], // Enclosed CJK Letters and Months
92
+ [0x3300, 0x33FF], // CJK Compatibility
93
+ [0x3400, 0x4DB5], // CJK Unified Ideographs Extension A
94
+ [0x4E00, 0x9FFF], // CJK Unified Ideographs
95
+ [0xA000, 0xA48F], // Yi Syllables
96
+ [0xA490, 0xA4CF], // Yi Radicals
97
+ [0xAC00, 0xD7A3], // Hangul Syllables
98
+ [0xD800, 0xDB7F], // High Surrogates
99
+ [0xDB80, 0xDBFF], // High Private Use Surrogates
100
+ [0xDC00, 0xDFFF], // Low Surrogates
101
+ [0xE000, 0xF8FF], // Private Use
102
+ [0xF900, 0xFAFF], // CJK Compatibility Ideographs
103
+ [0xFB00, 0xFB4F], // Alphabetic Presentation Forms
104
+ [0xFB50, 0xFDFF], // Arabic Presentation Forms-A
105
+ [0xFE20, 0xFE2F], // Combining Half Marks
106
+ [0xFE30, 0xFE4F], // CJK Compatibility Forms
107
+ [0xFE50, 0xFE6F], // Small Form Variants
108
+ [0xFE70, 0xFEFE], // Arabic Presentation Forms-B
109
+ [0xFEFF, 0xFEFF], // Specials
110
+ [0xFF00, 0xFFEF], // Halfwidth and Fullwidth Forms
111
+ [0xFFF0, 0xFFFD] // Specials
112
+ ];
113
+
114
+ var defaults = {
115
+ minimumChars: 8,
116
+ strengthScaleFactor: 1,
117
+ bannedPasswords: COMPLEXIFY_BANLIST,
118
+ banmode: 'strict' // (strict|loose)
119
+ };
120
+
121
+ if($.isFunction(options) && !callback) {
122
+ callback = options;
123
+ options = {};
124
+ }
125
+
126
+ options = $.extend(defaults, options);
127
+
128
+ function additionalComplexityForCharset(str, charset) {
129
+ for (var i = str.length - 1; i >= 0; i--) {
130
+ if (charset[0] <= str.charCodeAt(i) && str.charCodeAt(i) <= charset[1]) {
131
+ return charset[1] - charset[0] + 1;
132
+ }
133
+ }
134
+ return 0;
135
+ }
136
+
137
+ function inBanlist(str) {
138
+ if (options.banmode === 'strict') {
139
+ for (var i = 0; i < options.bannedPasswords.length; i++) {
140
+ if (options.bannedPasswords[i].indexOf(str) !== -1) {
141
+ return true;
142
+ }
143
+ }
144
+ return false;
145
+ } else {
146
+ return $.inArray(str, options.bannedPasswords) > -1 ? true : false;
147
+ }
148
+ }
149
+
150
+ function evaluateSecurity() {
151
+ var password = $(this).val();
152
+ var complexity = 0, valid = false;
153
+
154
+ // Reset complexity to 0 when banned password is found
155
+ if (!inBanlist(password)) {
156
+
157
+ // Add character complexity
158
+ for (var i = CHARSETS.length - 1; i >= 0; i--) {
159
+ complexity += additionalComplexityForCharset(password, CHARSETS[i]);
160
+ }
161
+
162
+ } else {
163
+ complexity = 1;
164
+ }
165
+
166
+ // Use natural log to produce linear scale
167
+ complexity = Math.log(Math.pow(complexity, password.length)) * (1/options.strengthScaleFactor);
168
+
169
+ valid = (complexity > MIN_COMPLEXITY && password.length >= options.minimumChars);
170
+
171
+ // Scale to percentage, so it can be used for a progress bar
172
+ complexity = (complexity / MAX_COMPLEXITY) * 100;
173
+ complexity = (complexity > 100) ? 100 : complexity;
174
+
175
+ callback.call(this, valid, complexity);
176
+ }
177
+
178
+ return this.each(function () {
179
+ $(this).bind('keyup focus', evaluateSecurity);
180
+ });
181
+
182
+ }
183
+ });
184
+
185
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ require "jquery-complexify-rails/version"
2
+ require "jquery-complexify-rails/engine" if defined?(::Rails)
@@ -0,0 +1,6 @@
1
+ module JQueryComplexify
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module JQueryComplexify
2
+ module Rails
3
+ VERSION = "0.3.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery-complexify-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
+ platform: ruby
6
+ authors:
7
+ - Pablo Lluch
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.1'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '3.1'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.0'
33
+ description: jQuery Complexify plugin packaged for the Rails 3.1+ pipeline
34
+ email:
35
+ - pablo.lluch@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - LICENSE
41
+ - README.rdoc
42
+ - Rakefile
43
+ - app/assets/javascripts/jquery.complexify.banlist.js
44
+ - app/assets/javascripts/jquery.complexify.js
45
+ - lib/jquery-complexify-rails.rb
46
+ - lib/jquery-complexify-rails/engine.rb
47
+ - lib/jquery-complexify-rails/version.rb
48
+ homepage: https://github.com/pelluch/jquery-complexify-rails/
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.2.0
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Asset gemification of the jQuery Complexify plugin
72
+ test_files: []