0
app/assets/images/custom/.keep
Normal file
0
app/assets/images/custom/.keep
Normal file
@@ -45,6 +45,7 @@
|
||||
//= require valuation_spending_proposal_form
|
||||
//= require embed_video
|
||||
//= require banners
|
||||
//= require custom
|
||||
|
||||
var initialize_modules = function() {
|
||||
App.Comments.initialize();
|
||||
|
||||
7
app/assets/javascripts/custom.js
Normal file
7
app/assets/javascripts/custom.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// Overrides and adds customized javascripts in this file
|
||||
// Read more on documentation:
|
||||
// * English: https://github.com/consul/consul/blob/master/CUSTOMIZE_EN.md#javascript
|
||||
// * Spanish: https://github.com/consul/consul/blob/master/CUSTOMIZE_ES.md#javascript
|
||||
//
|
||||
//
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
// Overrides and adds customized styles in this file
|
||||
//
|
||||
// Read more on documentation:
|
||||
// * English: https://github.com/consul/consul/blob/master/CUSTOMIZE_EN.md#css
|
||||
// * Spanish: https://github.com/consul/consul/blob/master/CUSTOMIZE_ES.md#css
|
||||
//
|
||||
|
||||
0
app/models/custom/.keep
Normal file
0
app/models/custom/.keep
Normal file
29
app/models/custom/verification/residence.rb
Normal file
29
app/models/custom/verification/residence.rb
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
require_dependency Rails.root.join('app', 'models', 'verification', 'residence').to_s
|
||||
|
||||
class Verification::Residence
|
||||
|
||||
validate :postal_code_in_madrid
|
||||
validate :residence_in_madrid
|
||||
|
||||
def postal_code_in_madrid
|
||||
errors.add(:postal_code, I18n.t('verification.residence.new.error_not_allowed_postal_code')) unless valid_postal_code?
|
||||
end
|
||||
|
||||
def residence_in_madrid
|
||||
return if errors.any?
|
||||
|
||||
unless residency_valid?
|
||||
errors.add(:residence_in_madrid, false)
|
||||
store_failed_attempt
|
||||
Lock.increase_tries(user)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def valid_postal_code?
|
||||
postal_code =~ /^280/
|
||||
end
|
||||
|
||||
end
|
||||
@@ -16,8 +16,6 @@ class Verification::Residence
|
||||
|
||||
validate :allowed_age
|
||||
validate :document_number_uniqueness
|
||||
validate :postal_code_in_madrid
|
||||
validate :residence_in_madrid
|
||||
|
||||
def initialize(attrs={})
|
||||
self.date_of_birth = parse_date('date_of_birth', attrs)
|
||||
@@ -45,20 +43,6 @@ class Verification::Residence
|
||||
errors.add(:document_number, I18n.t('errors.messages.taken')) if User.where(document_number: document_number).any?
|
||||
end
|
||||
|
||||
def postal_code_in_madrid
|
||||
errors.add(:postal_code, I18n.t('verification.residence.new.error_not_allowed_postal_code')) unless valid_postal_code?
|
||||
end
|
||||
|
||||
def residence_in_madrid
|
||||
return if errors.any?
|
||||
|
||||
unless residency_valid?
|
||||
errors.add(:residence_in_madrid, false)
|
||||
store_failed_attempt
|
||||
Lock.increase_tries(user)
|
||||
end
|
||||
end
|
||||
|
||||
def store_failed_attempt
|
||||
FailedCensusCall.create({
|
||||
user: user,
|
||||
@@ -97,8 +81,4 @@ class Verification::Residence
|
||||
self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase unless self.document_number.blank?
|
||||
end
|
||||
|
||||
def valid_postal_code?
|
||||
postal_code =~ /^280/
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
0
app/views/custom/.keep
Normal file
0
app/views/custom/.keep
Normal file
Reference in New Issue
Block a user