has_secure_attribute 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 791d8b4c2ad53a2ab79fe663e7e6e7e19b355e90
4
- data.tar.gz: ecebf104e0f461d50c064d86d9441581f6950b9f
3
+ metadata.gz: 407ec97a134d4ff2d2ecc448a0c2b538b51945f9
4
+ data.tar.gz: 26c2a1fef2541a2954e468714effe93cf6fbe8cd
5
5
  SHA512:
6
- metadata.gz: 758ae145496f31c48766909bffd81d03dd316a458e3bea9d6027061de6bf2b6437d94e58fb6f57db087d9579e003a98b2b70f8760cc74fd9ab37f28eee32e7b1
7
- data.tar.gz: 42305c94aede34da459b9f0611ca57a157808c5556027c3225628651485adc5107a9d53893de1d950cf50a46c2daad708120fd88dda4e48ddb6e9ff3f2b45771
6
+ metadata.gz: 3851f367a95043922611cf6f73589e1ddcb5f0e14c4eefe64425ed243ebea0633af5571ce6d830862032746daef3352812a36a20818bd917cf694b1ae0448aab
7
+ data.tar.gz: e22119c5300c2128acaa8dc803dec34e0f0b417770d595d89087ea83fbebed59d4a71a999fb15da96f48a55f073475c1e3badd57d611ee0ac45726df373a89e1
data/README.md CHANGED
@@ -1,2 +1,46 @@
1
- Under construction
2
- ==================
1
+ `has_secure_attribute`
2
+ ======================
3
+
4
+ Why have `has_secure_password` and not any attribute that you want. I believe that, quite often, we want to one-way encrypt one attribute and authenticate against its value, and this is not only the `password` case.
5
+
6
+ Requires
7
+ --------
8
+
9
+ `ActiveRecord` and `BCrypt`
10
+
11
+ Install
12
+ -------
13
+
14
+ `gem install 'has_secure_attribute'`
15
+
16
+ or in your `Gemfile`
17
+
18
+ `gem 'has_secure_attribute'` and then `bundle`
19
+
20
+ Use it
21
+ ------
22
+
23
+ class User < ActiveRecord::Base
24
+ has_secure_security_answer
25
+ end
26
+
27
+ In the above example:
28
+
29
+ * Your should have a `users` table that has one column: `security_answer_digest`.
30
+ * It creates a reader: `security_answer`.
31
+ * It creates a writer: `security_answer=(value)` which basically saves the security answer given into the database on column `security_answer_digest` but is saves it encrypted.
32
+ * It adds some validations (if you want to avoid having these validations: `has_secure_security_answer :validations => false`).
33
+ * It creates a confirmation validation on `security_answer` but only if `security_answer` is given (for confirmation validations see [this](http://http://guides.rubyonrails.org/active_record_validations.html#confirmation)).
34
+ * It creates a presence validation on `security_answer` but only on create.
35
+ * It creates a presence validation on `security_answer_confirmation` but only if `security_answer` has been given.
36
+ * It raises an exception if `security_answer_digest` is empty on create.
37
+ * It defines the method `authenticate_security_answer(answer_to_authenticate)` which returns `false` if the answer given does not correspond to the saved digest, or returns the object instance itself if it does.
38
+
39
+ Do you want to test it?
40
+ ------------------------
41
+
42
+ `bundle exec rake`
43
+
44
+ __Note:__ Testing works with a MySQL database. So, you need to have MySQL installed. Other than that, everything else needed to run the tests is done automatically. (db create, db migrate e.t.c.)
45
+
46
+
@@ -1,3 +1,3 @@
1
1
  module HasSecureAttribute
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_secure_attribute
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Panayotis Matsinopoulos