usernames 0.1.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.
Files changed (84) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +39 -0
  3. data/LICENSE.txt +21 -0
  4. data/README.md +362 -0
  5. data/SECURITY.md +42 -0
  6. data/config/locales/usernames.en.yml +72 -0
  7. data/config/locales/usernames.es.yml +51 -0
  8. data/config/locales/usernames.pt.yml +51 -0
  9. data/data/LICENSES/allprofanity.txt +24 -0
  10. data/data/LICENSES/big-username-blocklist.txt +25 -0
  11. data/data/LICENSES/corpora.txt +128 -0
  12. data/data/LICENSES/cuss.txt +25 -0
  13. data/data/LICENSES/django-registration.txt +33 -0
  14. data/data/LICENSES/dsojevic-profanity-list.txt +24 -0
  15. data/data/LICENSES/forwardemail.txt +24 -0
  16. data/data/LICENSES/friendly-words.txt +24 -0
  17. data/data/LICENSES/gitea.txt +23 -0
  18. data/data/LICENSES/gitlab.txt +31 -0
  19. data/data/LICENSES/iana-well-known-uris.txt +130 -0
  20. data/data/LICENSES/imsky-wordlists.txt +24 -0
  21. data/data/LICENSES/mottie-github-reserved-names.txt +24 -0
  22. data/data/LICENSES/obscenity.txt +27 -0
  23. data/data/LICENSES/petname.txt +218 -0
  24. data/data/LICENSES/rfc2142.txt +9 -0
  25. data/data/LICENSES/shouldbee.txt +25 -0
  26. data/data/LICENSES/usernames.txt +30 -0
  27. data/data/NOTICE +36 -0
  28. data/data/offensive/README.md +90 -0
  29. data/data/offensive/allowlist/en.txt +727 -0
  30. data/data/offensive/allowlist/es.txt +39 -0
  31. data/data/offensive/en.json +5680 -0
  32. data/data/offensive/es.json +1014 -0
  33. data/data/offensive/hate.yml +51 -0
  34. data/data/offensive/leet.yml +27 -0
  35. data/data/reserved/ALLOWLIST_EXCEPTIONS.txt +6 -0
  36. data/data/reserved/impersonation.txt +69 -0
  37. data/data/reserved/mailboxes.txt +77 -0
  38. data/data/reserved/system.txt +124 -0
  39. data/data/reserved/web.txt +962 -0
  40. data/data/words/adjectives.txt +367 -0
  41. data/data/words/animals.txt +253 -0
  42. data/lib/generators/usernames/availability_generator.rb +67 -0
  43. data/lib/generators/usernames/existing_schema.rb +85 -0
  44. data/lib/generators/usernames/install_generator.rb +241 -0
  45. data/lib/generators/usernames/install_messages.rb +63 -0
  46. data/lib/generators/usernames/locale_generator.rb +56 -0
  47. data/lib/generators/usernames/templates/add_username.rb.erb +53 -0
  48. data/lib/generators/usernames/templates/availability/_field.html.erb.tt +25 -0
  49. data/lib/generators/usernames/templates/availability/availability_controller.rb.tt +107 -0
  50. data/lib/generators/usernames/templates/availability/username_check_controller.js.tt +115 -0
  51. data/lib/generators/usernames/templates/usernames.rb +34 -0
  52. data/lib/tasks/usernames.rake +38 -0
  53. data/lib/usernames/adapters/moderate.rb +37 -0
  54. data/lib/usernames/audit/output.rb +51 -0
  55. data/lib/usernames/audit/values.rb +34 -0
  56. data/lib/usernames/audit.rb +230 -0
  57. data/lib/usernames/candidates.rb +64 -0
  58. data/lib/usernames/comparison/index_contract.rb +241 -0
  59. data/lib/usernames/comparison/index_expression.rb +183 -0
  60. data/lib/usernames/comparison.rb +127 -0
  61. data/lib/usernames/configuration.rb +197 -0
  62. data/lib/usernames/data.rb +205 -0
  63. data/lib/usernames/engine.rb +32 -0
  64. data/lib/usernames/errors.rb +16 -0
  65. data/lib/usernames/generator.rb +206 -0
  66. data/lib/usernames/model.rb +397 -0
  67. data/lib/usernames/normalizer.rb +51 -0
  68. data/lib/usernames/offensive/hate.rb +124 -0
  69. data/lib/usernames/offensive/lexicon.rb +156 -0
  70. data/lib/usernames/offensive/name.rb +254 -0
  71. data/lib/usernames/offensive.rb +136 -0
  72. data/lib/usernames/phrase.rb +68 -0
  73. data/lib/usernames/reserved/listing.rb +79 -0
  74. data/lib/usernames/reserved.rb +219 -0
  75. data/lib/usernames/result.rb +52 -0
  76. data/lib/usernames/rules/options.rb +175 -0
  77. data/lib/usernames/rules.rb +257 -0
  78. data/lib/usernames/unique_violation.rb +176 -0
  79. data/lib/usernames/validator.rb +61 -0
  80. data/lib/usernames/version.rb +5 -0
  81. data/lib/usernames/words.rb +13 -0
  82. data/lib/usernames.rb +138 -0
  83. data/sig/usernames.rbs +75 -0
  84. metadata +217 -0
@@ -0,0 +1,367 @@
1
+ abiding
2
+ able
3
+ abounding
4
+ abundant
5
+ accessible
6
+ accurate
7
+ adaptable
8
+ adaptive
9
+ adorable
10
+ agreeable
11
+ airy
12
+ alert
13
+ alive
14
+ alluring
15
+ amazing
16
+ ambitious
17
+ amenable
18
+ amused
19
+ amusing
20
+ animated
21
+ artistic
22
+ aspiring
23
+ attractive
24
+ available
25
+ awake
26
+ aware
27
+ awesome
28
+ balanced
29
+ beautiful
30
+ beneficial
31
+ better
32
+ big
33
+ bold
34
+ brainy
35
+ brave
36
+ brawny
37
+ breezy
38
+ brief
39
+ bright
40
+ bubbly
41
+ bustling
42
+ busy
43
+ calm
44
+ capable
45
+ carefree
46
+ careful
47
+ caring
48
+ casual
49
+ celestial
50
+ certain
51
+ changeable
52
+ charmed
53
+ charming
54
+ cheerful
55
+ chief
56
+ childlike
57
+ chivalrous
58
+ classic
59
+ classy
60
+ clean
61
+ clear
62
+ clever
63
+ climbing
64
+ coherent
65
+ colossal
66
+ complete
67
+ concise
68
+ concrete
69
+ confirmed
70
+ conscious
71
+ continuous
72
+ cool
73
+ cosmic
74
+ courageous
75
+ creative
76
+ cuddly
77
+ cultured
78
+ curious
79
+ dandy
80
+ dapper
81
+ dashing
82
+ dazzling
83
+ dear
84
+ debonair
85
+ decisive
86
+ decorous
87
+ dedicated
88
+ deep
89
+ defiant
90
+ delicate
91
+ delicious
92
+ delightful
93
+ deluxe
94
+ determined
95
+ developing
96
+ different
97
+ diligent
98
+ discreet
99
+ distinct
100
+ dynamic
101
+ eager
102
+ earthy
103
+ easy
104
+ economic
105
+ educated
106
+ efficient
107
+ electric
108
+ elegant
109
+ elemental
110
+ eminent
111
+ enchanted
112
+ enchanting
113
+ energetic
114
+ enormous
115
+ equal
116
+ ethereal
117
+ excellent
118
+ excited
119
+ exciting
120
+ exclusive
121
+ expensive
122
+ exuberant
123
+ exultant
124
+ fabulous
125
+ factual
126
+ fair
127
+ faithful
128
+ familiar
129
+ famous
130
+ fancy
131
+ fantastic
132
+ fascinated
133
+ fast
134
+ fearless
135
+ festive
136
+ fine
137
+ first
138
+ flashy
139
+ flawless
140
+ fluttering
141
+ flying
142
+ foremost
143
+ fortunate
144
+ fragrant
145
+ free
146
+ fresh
147
+ full
148
+ funny
149
+ gainful
150
+ gentle
151
+ gifted
152
+ glamorous
153
+ gleaming
154
+ glistening
155
+ glorious
156
+ glowing
157
+ golden
158
+ good
159
+ gorgeous
160
+ graceful
161
+ grand
162
+ grateful
163
+ great
164
+ gregarious
165
+ groovy
166
+ guiltless
167
+ handsome
168
+ handy
169
+ happy
170
+ harmless
171
+ harmonious
172
+ healthy
173
+ helpful
174
+ hilarious
175
+ hospitable
176
+ humane
177
+ humble
178
+ humorous
179
+ immediate
180
+ immense
181
+ impartial
182
+ important
183
+ incredible
184
+ innate
185
+ innovative
186
+ internal
187
+ intriguing
188
+ invincible
189
+ iridescent
190
+ joyous
191
+ judicious
192
+ just
193
+ keen
194
+ kind
195
+ knowing
196
+ lavish
197
+ legendary
198
+ liberating
199
+ light
200
+ literate
201
+ lithe
202
+ living
203
+ loving
204
+ lucky
205
+ luminous
206
+ lush
207
+ luxuriant
208
+ magical
209
+ magnetic
210
+ majestic
211
+ malleable
212
+ massive
213
+ mellow
214
+ melodious
215
+ merciful
216
+ mighty
217
+ mint
218
+ modern
219
+ modest
220
+ momentous
221
+ mutual
222
+ natural
223
+ neat
224
+ necessary
225
+ nice
226
+ nifty
227
+ nimble
228
+ noble
229
+ nonchalant
230
+ observant
231
+ obtainable
232
+ open
233
+ organic
234
+ outgoing
235
+ pacific
236
+ peaceful
237
+ perfect
238
+ perpetual
239
+ persistent
240
+ placid
241
+ plausible
242
+ playful
243
+ pleasant
244
+ plucky
245
+ poised
246
+ polished
247
+ polite
248
+ popular
249
+ positive
250
+ possible
251
+ potent
252
+ powerful
253
+ precious
254
+ pretty
255
+ probable
256
+ productive
257
+ profuse
258
+ protective
259
+ proud
260
+ pumped
261
+ quaint
262
+ quick
263
+ quiet
264
+ rapid
265
+ rare
266
+ real
267
+ receptive
268
+ regal
269
+ regular
270
+ reliable
271
+ relieved
272
+ remarkable
273
+ resilient
274
+ resolute
275
+ respected
276
+ rich
277
+ right
278
+ righteous
279
+ rightful
280
+ robust
281
+ romantic
282
+ safe
283
+ sage
284
+ sassy
285
+ satisfying
286
+ scented
287
+ scientific
288
+ seasoned
289
+ serene
290
+ sharp
291
+ shining
292
+ showy
293
+ simple
294
+ sincere
295
+ smart
296
+ smiling
297
+ smooth
298
+ solid
299
+ sparkling
300
+ special
301
+ spiritual
302
+ splendid
303
+ spotless
304
+ square
305
+ star
306
+ steadfast
307
+ steady
308
+ stellar
309
+ stirring
310
+ strong
311
+ stupendous
312
+ sturdy
313
+ stylish
314
+ suave
315
+ successful
316
+ succinct
317
+ succulent
318
+ sumptuous
319
+ sunny
320
+ super
321
+ superb
322
+ supreme
323
+ sustaining
324
+ sweet
325
+ talented
326
+ tangible
327
+ tasteful
328
+ tasty
329
+ tender
330
+ terrific
331
+ thankful
332
+ thoughtful
333
+ thrilling
334
+ tidy
335
+ tough
336
+ tranquil
337
+ tremendous
338
+ trusted
339
+ trusting
340
+ truthful
341
+ ubiquitous
342
+ understood
343
+ unique
344
+ universal
345
+ unusual
346
+ upbeat
347
+ useful
348
+ valiant
349
+ valuable
350
+ vast
351
+ versed
352
+ victorious
353
+ vigorous
354
+ vivacious
355
+ vivid
356
+ warm
357
+ wealthy
358
+ well
359
+ whimsical
360
+ wise
361
+ witty
362
+ wonderful
363
+ workable
364
+ working
365
+ youthful
366
+ zany
367
+ zealous
@@ -0,0 +1,253 @@
1
+ aardvark
2
+ adder
3
+ airedale
4
+ albatross
5
+ alligator
6
+ alpaca
7
+ anaconda
8
+ anemone
9
+ ant
10
+ anteater
11
+ antelope
12
+ armadillo
13
+ asp
14
+ baboon
15
+ badger
16
+ bat
17
+ beagle
18
+ bear
19
+ bee
20
+ beetle
21
+ bird
22
+ bison
23
+ blowfish
24
+ bluebird
25
+ bluejay
26
+ boa
27
+ boar
28
+ bobcat
29
+ boxer
30
+ buck
31
+ budgie
32
+ buffalo
33
+ bug
34
+ bull
35
+ bulldog
36
+ bullfrog
37
+ bunny
38
+ burro
39
+ buzzard
40
+ calf
41
+ camel
42
+ canary
43
+ capuchin
44
+ capybara
45
+ cardinal
46
+ caribou
47
+ cat
48
+ catfish
49
+ chameleon
50
+ cheetah
51
+ chickadee
52
+ chicken
53
+ chimp
54
+ chimpanzee
55
+ chinchilla
56
+ chipmunk
57
+ clam
58
+ cobra
59
+ collie
60
+ condor
61
+ copperhead
62
+ coral
63
+ corgi
64
+ cow
65
+ coyote
66
+ crab
67
+ crane
68
+ cricket
69
+ crocodile
70
+ crow
71
+ cub
72
+ cuckoo
73
+ dachshund
74
+ deer
75
+ dingo
76
+ dinosaur
77
+ doberman
78
+ dodo
79
+ doe
80
+ dog
81
+ dolphin
82
+ donkey
83
+ dove
84
+ duck
85
+ eagle
86
+ eel
87
+ elephant
88
+ elk
89
+ emu
90
+ ewe
91
+ falcon
92
+ fawn
93
+ ferret
94
+ finch
95
+ firefly
96
+ fish
97
+ flamingo
98
+ flounder
99
+ fly
100
+ foal
101
+ fox
102
+ frog
103
+ gator
104
+ gazelle
105
+ gecko
106
+ gibbon
107
+ giraffe
108
+ gnu
109
+ goat
110
+ goldfinch
111
+ goldfish
112
+ goose
113
+ gopher
114
+ gorilla
115
+ grizzly
116
+ hamster
117
+ hare
118
+ hawk
119
+ hedgehog
120
+ hen
121
+ heron
122
+ hippo
123
+ honeybee
124
+ horse
125
+ hound
126
+ husky
127
+ hyena
128
+ ibex
129
+ iguana
130
+ impala
131
+ jackal
132
+ jaguar
133
+ kangaroo
134
+ kitten
135
+ kiwi
136
+ koala
137
+ koi
138
+ labrador
139
+ ladybug
140
+ lamb
141
+ lemur
142
+ leopard
143
+ lion
144
+ lizard
145
+ llama
146
+ lobster
147
+ longhorn
148
+ lynx
149
+ macaw
150
+ magpie
151
+ malamute
152
+ mamba
153
+ mammoth
154
+ manatee
155
+ mandrill
156
+ mantis
157
+ marlin
158
+ marmoset
159
+ mastiff
160
+ mastodon
161
+ meerkat
162
+ mink
163
+ monarch
164
+ mongoose
165
+ monkey
166
+ moose
167
+ mouse
168
+ mule
169
+ muskrat
170
+ mustang
171
+ narwhal
172
+ ocelot
173
+ octopus
174
+ opossum
175
+ orangutan
176
+ orca
177
+ osprey
178
+ ostrich
179
+ otter
180
+ owl
181
+ panda
182
+ pangolin
183
+ panther
184
+ parakeet
185
+ parrot
186
+ pelican
187
+ penguin
188
+ pig
189
+ pigeon
190
+ platypus
191
+ pony
192
+ poodle
193
+ porcupine
194
+ porpoise
195
+ possum
196
+ puffin
197
+ pug
198
+ puma
199
+ pup
200
+ quail
201
+ rabbit
202
+ ram
203
+ raven
204
+ reindeer
205
+ retriever
206
+ rhino
207
+ rhinoceros
208
+ rooster
209
+ rottweiler
210
+ sailfish
211
+ salmon
212
+ schnauzer
213
+ scorpion
214
+ seagull
215
+ seahorse
216
+ seal
217
+ setter
218
+ shark
219
+ sheep
220
+ shrew
221
+ sloth
222
+ snail
223
+ snake
224
+ spaniel
225
+ sparrow
226
+ spider
227
+ squid
228
+ squirrel
229
+ stallion
230
+ starfish
231
+ stork
232
+ sunfish
233
+ swan
234
+ swift
235
+ tapir
236
+ terrier
237
+ tiger
238
+ toad
239
+ tortoise
240
+ toucan
241
+ trout
242
+ tuna
243
+ turtle
244
+ viper
245
+ wallaby
246
+ walrus
247
+ warthog
248
+ whale
249
+ wolf
250
+ wolverine
251
+ wombat
252
+ yak
253
+ zebra
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators/base"
4
+
5
+ module Usernames
6
+ module Generators
7
+ # rails generate usernames:availability [--model=User] [--column=username]
8
+ #
9
+ # Copies a live "is this name free?" check into the app:
10
+ # nothing is mounted behind its back, and every file is the app's to edit.
11
+ #
12
+ # app/controllers/usernames/availability_controller.rb GET /usernames/availability?<column>=…
13
+ # app/javascript/controllers/username_check_controller.js
14
+ # app/views/usernames/_field.html.erb <%= render "usernames/field", form: form %>
15
+ class AvailabilityGenerator < Rails::Generators::Base
16
+ source_root File.expand_path("templates/availability", __dir__)
17
+
18
+ desc "Copy a rate-limited availability endpoint, a Stimulus controller and a form partial into your app."
19
+
20
+ class_option :model, type: :string, default: "User", desc: "The model with has_username"
21
+ class_option :column, type: :string, default: "username", desc: "Its username column"
22
+
23
+ def create_controller
24
+ template "availability_controller.rb.tt", "app/controllers/usernames/availability_controller.rb"
25
+ end
26
+
27
+ # Thor injects a line only once, so a re-run leaves routes.rb alone.
28
+ def add_route
29
+ route %(get "usernames/availability", to: "usernames/availability#show", as: :usernames_availability)
30
+ end
31
+
32
+ def create_stimulus_controller
33
+ template "username_check_controller.js.tt", "app/javascript/controllers/username_check_controller.js"
34
+ end
35
+
36
+ def create_partial
37
+ template "_field.html.erb.tt", "app/views/usernames/_field.html.erb"
38
+ end
39
+
40
+ def display_post_install_message
41
+ say "\n\tThe `usernames` availability check has been successfully installed!", :green
42
+ say "\nTo complete the setup:"
43
+ say " 1. Render the field in your sign-up form: <%= render \"usernames/field\", form: form %>"
44
+ say " 2. If you don't use importmap's eagerLoadControllersFrom, register the Stimulus controller " \
45
+ "(rails stimulus:manifest:update)."
46
+ say " 3. Give production a shared cache store (Solid Cache, Redis or Memcached). With the NullStore, " \
47
+ "Rails' rate_limit counts nothing, so the endpoint answers 503 there until you do."
48
+ say "\nThe route is declared at the top of config/routes.rb, so a catch-all /:#{column} below it can't shadow it."
49
+ say "Hints in the browser never block submission: the model and its unique index decide.", :green
50
+ end
51
+
52
+ private
53
+
54
+ def model_name
55
+ options[:model].camelize
56
+ end
57
+
58
+ def singular
59
+ model_name.underscore.tr("/", "_")
60
+ end
61
+
62
+ def column
63
+ options[:column].to_s
64
+ end
65
+ end
66
+ end
67
+ end