Merge branch 'master' into 1725-census_local_copy_user_verification

This commit is contained in:
María Checa
2017-07-14 15:50:26 +02:00
269 changed files with 2580 additions and 1000 deletions

View File

@@ -27,7 +27,7 @@ class Verification::Email
end
def self.find(user, token)
self.valid_token?(user, token)
valid_token?(user, token)
end
def self.valid_token?(user, token)

View File

@@ -25,9 +25,9 @@ class Verification::Management::Document
def valid_age?(response)
if under_age?(response)
errors.add(:age, true)
return false
false
else
return true
true
end
end

View File

@@ -31,15 +31,15 @@ class Verification::Residence
user.update(document_number: document_number,
document_type: document_type,
geozone: self.geozone,
geozone: geozone,
date_of_birth: date_of_birth.to_datetime,
gender: gender,
residence_verified_at: Time.current)
end
def allowed_age
return if errors[:date_of_birth].any?
errors.add(:date_of_birth, I18n.t('verification.residence.new.error_not_allowed_age')) unless Age.in_years(self.date_of_birth) >= User.minimum_required_age
return if errors[:date_of_birth].any? || Age.in_years(date_of_birth) >= User.minimum_required_age
errors.add(:date_of_birth, I18n.t('verification.residence.new.error_not_allowed_age'))
end
def document_number_uniqueness
@@ -81,7 +81,7 @@ class Verification::Residence
end
def clean_document_number
self.document_number = self.document_number.gsub(/[^a-z0-9]+/i, "").upcase if self.document_number.present?
self.document_number = document_number.gsub(/[^a-z0-9]+/i, "").upcase if document_number.present?
end
end

View File

@@ -12,7 +12,7 @@ class Verification::Sms
end
def save
return false unless self.valid?
return false unless valid?
update_user_phone_information
send_sms
Lock.increase_tries(user)