https://github.com/lautis/encrypted_form_fields
Encrypted form fields for Rails apps.
https://github.com/lautis/encrypted_form_fields
Last synced: 2 months ago
JSON representation
Encrypted form fields for Rails apps.
- Host: GitHub
- URL: https://github.com/lautis/encrypted_form_fields
- Owner: lautis
- License: mit
- Created: 2013-12-01T11:27:33.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-11-21T15:05:36.000Z (over 4 years ago)
- Last Synced: 2025-03-23T13:51:37.547Z (2 months ago)
- Language: Ruby
- Size: 39.1 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# EncryptedFormFields
Encrypted form fields for Rails apps.
[](https://travis-ci.org/lautis/encrypted_form_fields)
[](http://badge.fury.io/rb/encrypted_form_fields)## Installation
Add this line to your application's Gemfile:
gem 'encrypted_form_fields'
And then execute:
$ bundle
Or install it yourself as:
$ gem install encrypted_form_fields
## Usage
Configure necessary encryption keys in Rails initializer:
```ruby
EncryptedFormFields.secret_key_base = # your secret key base
EncryptedFormFields.secret_token = # your secret token```
Create encrypted inputs in your view:
```erb
<%= form_for(user) do |f| %>
<%= f.encrypted_field :secrets %>
<%= encrypted_field_tag :field_name, "secret data" %>
<% end %>```
Then access the data in controller:
```ruby
class SomeController
def create
# do stuff...
encrypted_params # This will contain values of encrypted parameters
# do stuff...
end
end
```## Contributing
1. Fork it ( http://github.com/lautis/encrypted_form_fields/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request