devise_latcheable 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/lib/devise_latcheable/strategy.rb +5 -1
- data/lib/devise_latcheable/version.rb +1 -1
- data/lib/generators/templates/latch.yml +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379693f10790abde6f4cf2e9599df5c81067d950
|
4
|
+
data.tar.gz: 77c901493d78beccf714f2c7aa54530b396fedf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73e7a69efcb758dbc818b930312c67ea66e38ab00c0f43495ce8f1fe6e0e47b900c89365a387eab6435bd31660a483e35bcf0d2e6f033095b47da1b3fd92e000
|
7
|
+
data.tar.gz: 4ab0b88692b79965c2e594b64ac32fdcdfc588344f60bf1c9332bd5b15650dedd815aaabb16ff1e629c34b5f47a6fe0113a9a896b4296b896be0ff7198443a5c
|
data/README.md
CHANGED
@@ -107,6 +107,27 @@ user = User.find_by name: 'Test'
|
|
107
107
|
user.latch_account_id
|
108
108
|
```
|
109
109
|
|
110
|
+
### Methods on the users model
|
111
|
+
|
112
|
+
#### latch_pair!
|
113
|
+
Pairs an user with the server.
|
114
|
+
If an error occurs, it copies the error at errors base
|
115
|
+
so you can access it with model_instance.errors
|
116
|
+
On success, it sets latch_account_id to the value that
|
117
|
+
latch server sent on its response
|
118
|
+
@returns true on success, false otherwise
|
119
|
+
|
120
|
+
### latch_unpair!
|
121
|
+
Removes the pairing from latch
|
122
|
+
If an error occurs, it copies the error at errors base
|
123
|
+
so you can access it with model_instance.errors
|
124
|
+
@returns true on success, false otherwise
|
125
|
+
|
126
|
+
### latch_unlocked?
|
127
|
+
Checks if the app lock is open
|
128
|
+
@returns true if the latch is unlocked
|
129
|
+
@returns false if the latch is locked or if there was an error
|
130
|
+
|
110
131
|
## Demo
|
111
132
|
There is a app already configured with devise and devise\_latcheable at
|
112
133
|
[this repo](https://github.com/CarlosRdrz/latch_app) for demo and
|
@@ -7,7 +7,11 @@ module Devise
|
|
7
7
|
resource = mapping.to.find_by(authentication_hash)
|
8
8
|
|
9
9
|
if resource && validate(resource) { resource.latch_unlocked? }
|
10
|
-
|
10
|
+
if ::DeviseLatcheable.config['latch_only'] == true
|
11
|
+
success! resource
|
12
|
+
else
|
13
|
+
pass
|
14
|
+
end
|
11
15
|
else
|
12
16
|
fail 'Latch is locked. Unlock and try again.'
|
13
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_latcheable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|