Increase max length of simple_captcha to 12

This commit is contained in:
jaideng123 2014-08-26 13:16:47 -05:00
parent e3dc82bdcd
commit f53001577e
4 changed files with 18 additions and 5 deletions

View file

@ -289,7 +289,7 @@ configuration: ## Section
## Captcha image size (default='120x20') ## Captcha image size (default='120x20')
#image_size: '120x20' #image_size: '120x20'
## Length of captcha text (default=5) ## Length of captcha text (default=5)(max=12)
#captcha_length: 5 #captcha_length: 5
## Captcha image style (default='simply_green') ## Captcha image style (default='simply_green')

View file

@ -1,6 +1,11 @@
SimpleCaptcha.setup do |sc| SimpleCaptcha.setup do |sc|
sc.image_size = AppConfig.settings.captcha.image_size sc.image_size = AppConfig.settings.captcha.image_size
sc.length = AppConfig.settings.captcha.captcha_length.to_i value_length = AppConfig.settings.captcha.captcha_length.to_i
if value_length <= 12 && value_length > 0
sc.length = value_length
else
sc.length = 5
end
sc.image_style = AppConfig.settings.captcha.image_style sc.image_style = AppConfig.settings.captcha.image_style
sc.distortion = AppConfig.settings.captcha.distortion sc.distortion = AppConfig.settings.captcha.distortion
p AppConfig.settings.captcha p AppConfig.settings.captcha

View file

@ -0,0 +1,8 @@
class IncreaseSimpleCaptchaLimit < ActiveRecord::Migration
def self.up
change_column :simple_captcha_data, :value, :string, :limit => 12
end
def self.down
change_column :simple_captcha_data, :value, :string, :limit => 6
end
end

View file

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140824230505) do ActiveRecord::Schema.define(version: 20140826165533) do
create_table "account_deletions", force: true do |t| create_table "account_deletions", force: true do |t|
t.string "diaspora_handle" t.string "diaspora_handle"
@ -449,7 +449,7 @@ ActiveRecord::Schema.define(version: 20140824230505) do
create_table "simple_captcha_data", force: true do |t| create_table "simple_captcha_data", force: true do |t|
t.string "key", limit: 40 t.string "key", limit: 40
t.string "value", limit: 6 t.string "value", limit: 12
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
end end