Sha256: 12e3688999a14f94e1aef6c4a5611a65b481a8d0f23d7c50891f6e8f737f007c
Contents?: true
Size: 950 Bytes
Versions: 2
Compression:
Stored size: 950 Bytes
Contents
module EncryptedFormFields module Helpers module FormTagHelper # Creates a hidden input field used with encrypted content. Use this field # to transmit data that user shouldn't see or be able to modify. # # ==== Options # * Creates standard HTML attributes for the tag. # # ==== Examples # encrypted_field_tag 'email_verified_at', Time.now.to_s # => <input id="email_verified_at" name="_encrypted_email_verified_at" type="hidden" value="[encrypted]" /> def encrypted_field_tag(name, value = nil, options = {}) encrypted_value = EncryptedFormFields.encrypt_and_sign(value) prefixed_name = EncryptedFormFields.prefix_name(name.to_s) tag :input, { "type" => "hidden", "name" => prefixed_name, "id" => sanitize_to_id(name), "value" => encrypted_value }.update(options.stringify_keys) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
encrypted_form_fields-0.2.1 | lib/encrypted_form_fields/helpers/form_tag_helper.rb |
encrypted_form_fields-0.2.0 | lib/encrypted_form_fields/helpers/form_tag_helper.rb |