validates acceptance of census terms of service
This commit is contained in:
@@ -20,7 +20,7 @@ class Verification::ResidenceController < ApplicationController
|
||||
private
|
||||
|
||||
def residence_params
|
||||
params.require(:residence).permit(:document_number, :document_type, :date_of_birth, :postal_code)
|
||||
params.require(:residence).permit(:document_number, :document_type, :date_of_birth, :postal_code, :terms_of_service)
|
||||
end
|
||||
|
||||
def verify_attemps_left!
|
||||
|
||||
@@ -2,12 +2,13 @@ class Verification::Residence
|
||||
include ActiveModel::Model
|
||||
include ActiveModel::Dates
|
||||
|
||||
attr_accessor :user, :document_number, :document_type, :date_of_birth, :postal_code
|
||||
attr_accessor :user, :document_number, :document_type, :date_of_birth, :postal_code, :terms_of_service
|
||||
|
||||
validates_presence_of :document_number
|
||||
validates_presence_of :document_type
|
||||
validates_presence_of :date_of_birth
|
||||
validates_presence_of :postal_code
|
||||
validates :terms_of_service, acceptance: { allow_nil: false }
|
||||
|
||||
validates :postal_code, length: { is: 5 }
|
||||
|
||||
|
||||
@@ -13,6 +13,15 @@
|
||||
start_year: 1900, end_year: 16.years.ago.year %>
|
||||
<%= f.text_field :postal_code %>
|
||||
|
||||
<div class="small-12 column">
|
||||
<span class="left">
|
||||
<%= f.check_box :terms_of_service, label: t("verification.residence.new.accept_terms_text") %>
|
||||
</span>
|
||||
<span class="left" style="padding-left: 20px">
|
||||
<%= link_to t("verification.residence.new.accept_terms_link"), '/census_terms', target: "_blank" %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<%= f.submit "Verify" %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user