app_rail-airtable 0.2.10 → 0.2.11

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
  SHA256:
3
- metadata.gz: 3e57f8d279b01f1a7672be43fce5dda36da9df13bc3152399646f5be729d522c
4
- data.tar.gz: 7928368ae9d1b4edfd75c651af688be2aa0e7697f31fd5c87afb1a9e96e3945c
3
+ metadata.gz: 4042e0d7f3f72204f26f22d018c4e6fff171a76379e6961ac93511930566e43d
4
+ data.tar.gz: 95e44a95a516a1ef1afdaf14f47ff145deae55021c4b939e874033567515f234
5
5
  SHA512:
6
- metadata.gz: 5eef1c52f304ffe1b0050ff5a7278e47c825dce1e7e08a7af69550894070e23a465dc719fce7dddabfa06de9336f2b63d230685098d09a5c02711b17fe43394d
7
- data.tar.gz: e3629a453d333d78aac608f45ac04b303b27c636f4350fb0f5c2b42c739756a274faabd55a08278b0cc445a5777f62ae57431acea477dae20575ff1cfac53e59
6
+ metadata.gz: 71120e0e952456e41fb9f950d45b763306a038571694f37976c72e23824b4501bc8f87e141b765878e76dca4e438f6a12440da4112ba9803957902706865964d
7
+ data.tar.gz: 1da004d48fb6e02c0871a941423d191efcccf0b6a56d2c34123bf556e6b12756c589fab1ebca055ce6f5cd7eb0003cff19e815743bb2b7afc130bc0868674f13
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_rail-airtable (0.2.10)
4
+ app_rail-airtable (0.2.11)
5
5
  activesupport
6
6
  airrecord
7
7
  bcrypt
@@ -23,9 +23,10 @@ module AppRail
23
23
  end
24
24
 
25
25
  def find_by_email_and_password(email, password)
26
- all(filter: "AND({Email} = \"#{email}\",{Password Hash} = \"#{password_hash(password)}\")").first
26
+ user = all(filter: "AND({Email} = \"#{email}\"").first
27
+ user.valid_password? ? user : nil
27
28
  end
28
-
29
+
29
30
  def find_by_access_token(access_token)
30
31
  all(filter: "{Access Token} = \"#{access_token}\"").first
31
32
  end
@@ -38,6 +39,14 @@ module AppRail
38
39
  SecureRandom.hex
39
40
  end
40
41
  end
42
+
43
+ def valid_password?(password)
44
+ BCrypt::Password.new(password_hash) == password
45
+ end
46
+
47
+ def password_hash
48
+ self["Password Hash"]
49
+ end
41
50
 
42
51
  def oauth_session
43
52
  { access_token: self["Access Token"], scope: :user, refresh_token: "", token_type: :bearer, expires_in: 60000 }
@@ -1,5 +1,5 @@
1
1
  module AppRail
2
2
  module Airtable
3
- VERSION = "0.2.10"
3
+ VERSION = "0.2.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_rail-airtable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith