devise-uncommon_password 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fec8920be01efe2dad65aaa611a1e1ac240f6e98
4
+ data.tar.gz: 6b89c08574e04488c8ad56a55ff145c7af0dc8eb
5
+ SHA512:
6
+ metadata.gz: c5587d5299a528fa6a9dbd49bb21f92b2b9d532de350d8d08384c0fb6e469306f651a67915512e60bcc44b161f299ff0b91e6c331477ff3f4e3b67f9f748087a
7
+ data.tar.gz: 4dac11d3fbff0dcdef44203dea660c59f6fda48fdad80bc54cefaaaa8ba65f8b946ab3e1cea954bd498677730770d7435c460909e7a699181047d97fe8ea8d92
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2017 Chris Larsen
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.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Devise Uncommon Password
2
+ Devise::UncommonPassword is an extension for the devise gem, which prevents users from signing up using one of the 100 most common passwords. Currently, the list of common passwords is derived from the list at http://www.passwordrandom.com/most-popular-passwords. As devise already rejects passwords less than 8 characters in length, I removed all such passwords from the list, and then selected the top 100 from the remaining passwords.
3
+
4
+ ## Installation
5
+ Add this line to your application's Gemfile:
6
+
7
+ ```ruby
8
+ gem 'devise-uncommon_password'
9
+ ```
10
+
11
+ And then execute:
12
+ ```bash
13
+ $ bundle install
14
+ ```
15
+
16
+ Then add the ':uncommon_password' module to your model:
17
+ ```
18
+ class User < ActiveRecord::Base
19
+ devise :database_authenticatable, :registerable,
20
+ :recoverable, :rememberable, :trackable, :validatable, :uncommon_password
21
+ end
22
+ ```
23
+
24
+ And you're ready to go.
25
+
26
+ ## Contributing
27
+
28
+ You can contribute by doing the following:
29
+
30
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
31
+ * Fork it
32
+ * Write your changes
33
+ * Commit
34
+ * Send a pull request
35
+
36
+ ## License
37
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,33 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Devise::UncommonPassword'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+
33
+ task default: :test
@@ -0,0 +1,36 @@
1
+ module Devise
2
+ module Models
3
+ # The UncommonPassword module adds a new validation for Devise Models.
4
+ # No modifications to routes or controllers needed.
5
+ # Simply add :uncommon_password to the list of included modules in your
6
+ # devise module, and all new registrations will be blocked if they use
7
+ # a common password.
8
+ module UncommonPassword
9
+ extend ActiveSupport::Concern
10
+ # Returns a list of the 100 most common passwords.
11
+ def self.common_passwords
12
+ passwords_file = File.join(File.dirname(__FILE__), "passwords.txt")
13
+
14
+ passwords = []
15
+ File.open(passwords_file, "r") do |file|
16
+ file.each do |password|
17
+ passwords << password.chomp
18
+ end
19
+ end
20
+ passwords
21
+ end
22
+
23
+ included do
24
+ validate :not_common_password
25
+ end
26
+
27
+ private
28
+
29
+ def not_common_password
30
+ if Devise::Models::UncommonPassword.common_passwords.include? password.downcase
31
+ errors.add(:password, "is one of the 100 most common passwords. Please choose something harder to guess.")
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,100 @@
1
+ password
2
+ 12345678
3
+ baseball
4
+ football
5
+ jennifer
6
+ superman
7
+ trustno1
8
+ michelle
9
+ sunshine
10
+ 123456789
11
+ starwars
12
+ computer
13
+ corvette
14
+ princess
15
+ iloveyou
16
+ maverick
17
+ samantha
18
+ steelers
19
+ whatever
20
+ hardcore
21
+ internet
22
+ mercedes
23
+ bigdaddy
24
+ midnight
25
+ 11111111
26
+ marlboro
27
+ victoria
28
+ butthead
29
+ startrek
30
+ liverpoo
31
+ danielle
32
+ redskins
33
+ mountain
34
+ shithead
35
+ xxxxxxxx
36
+ 88888888
37
+ nicholas
38
+ metallic
39
+ qwertyui
40
+ dolphins
41
+ cocacola
42
+ rush2112
43
+ jonathan
44
+ scorpion
45
+ asdfasdf
46
+ godzilla
47
+ williams
48
+ lifehack
49
+ platinum
50
+ garfield
51
+ 69696969
52
+ jordan23
53
+ bullshit
54
+ airborne
55
+ elephant
56
+ explorer
57
+ christin
58
+ december
59
+ benjamin
60
+ dickhead
61
+ brooklyn
62
+ redwings
63
+ michigan
64
+ 87654321
65
+ guinness
66
+ einstein
67
+ snowball
68
+ alexande
69
+ passw0rd
70
+ lasvegas
71
+ slipknot
72
+ kimberly
73
+ 1q2w3e4r
74
+ carolina
75
+ colorado
76
+ creative
77
+ bollocks
78
+ darkness
79
+ asdfghjk
80
+ poohbear
81
+ nintendo
82
+ november
83
+ password1
84
+ lacrosse
85
+ paradise
86
+ maryjane
87
+ spitfire
88
+ anderson
89
+ cherokee
90
+ drowssap
91
+ marshall
92
+ 1qaz2wsx
93
+ caroline
94
+ franklin
95
+ snickers
96
+ courtney
97
+ westside
98
+ patricia
99
+ semperfi
100
+ freeuser
@@ -0,0 +1,5 @@
1
+ module Devise
2
+ module UncommonPassword
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require 'devise'
2
+ require 'devise/uncommon_password/model'
3
+
4
+ module Devise
5
+ module UncommonPassword
6
+ end
7
+ end
8
+
9
+ Devise.add_module :uncommon_password, model: "devise_uncommon_password/model"
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :devise_uncommon_password do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-uncommon_password
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Larsen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '5.2'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '4.2'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '5.2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: devise
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '3.5'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '4.4'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '3.5'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '4.4'
53
+ - !ruby/object:Gem::Dependency
54
+ name: sqlite3
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ type: :development
61
+ prerelease: false
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ description: Devise extension to prevent user from using a common password.
68
+ email:
69
+ - clarsenipod@gmail.com
70
+ executables: []
71
+ extensions: []
72
+ extra_rdoc_files: []
73
+ files:
74
+ - MIT-LICENSE
75
+ - README.md
76
+ - Rakefile
77
+ - lib/devise/uncommon_password.rb
78
+ - lib/devise/uncommon_password/model.rb
79
+ - lib/devise/uncommon_password/passwords.txt
80
+ - lib/devise/uncommon_password/version.rb
81
+ - lib/tasks/devise/uncommon_password_tasks.rake
82
+ homepage: https://github.com/HCLarsen/devise-uncommon_passwords
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.4.5.1
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Devise extension to prevent user from using a common password.
106
+ test_files: []