sphinx-oauth 1.0.1 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0205936d237456d8a63e5374356d8a8c3dc376c9
4
- data.tar.gz: 453f62e0163a5d973bd4a5be74caa47a813cb523
3
+ metadata.gz: b2c67f40a79256137a8d751d792e036caff0886f
4
+ data.tar.gz: 3eea3b90bdc303a437117b22beadf1064cd8f840
5
5
  SHA512:
6
- metadata.gz: 7d6f5836b093cf1fa88d7631b124294c33a2ace822315a47a5fe6eac67c8334aa0b6d2a9e55626879d05813115f86d022551c12100388c8cc291e859b5b46274
7
- data.tar.gz: da2119cd8a3b99b21244c36e94332009bc6bf4290f6042aa68e5d5e55ca40853b2e593930fc3e43ae57de1a545bf8341c5d4e1bcdcd5e9640c80f4ed2f6e8120
6
+ metadata.gz: 51ed8682ca1682d24171b42b9d0039d8a2b53075ecbf0aee4e0ff5e9d7d2f0131734145871916f5fb0d0fe7276215d9e8091ced0ede8902195c5a9e39bdf27e9
7
+ data.tar.gz: 07d0ae87af0ba1197cb281c13580db78b559be1a655211ef5336e59a76b3f3c45eebf4de37e7017a95c81db71cd47a42fff4079e5888ee73814341268ab39df8
data/lib/sphinx/oauth.rb CHANGED
@@ -6,10 +6,11 @@ module Sphinx
6
6
  if(grant_type.present? && grant_type == "password")
7
7
  if(checkValidRequest(authorization) && email.present? && password.present?)
8
8
  user = User.find_by_email(email)
9
- if(user.present? && comparePassword(user, password))
9
+ crypt = ActiveSupport::MessageEncryptor.new(Rails.application.config.SECRET_KEY)
10
+ user_password = crypt.encrypt_and_sign(user.password)
11
+ if(user.present? && comparePassword(user_password, password))
10
12
  oauthAccessToken = OauthAccessToken.find_by_user_name(email)
11
- crypt = ActiveSupport::MessageEncryptor.new(Rails.application.config.SECRET_KEY)
12
- if(!oauthAccessToken.present?)
13
+ if(!oauthAccessToken.present?)
13
14
  token = SecureRandom.uuid
14
15
  oauthAccessToken = OauthAccessToken.new
15
16
  token = SecureRandom.uuid
@@ -72,8 +73,8 @@ module Sphinx
72
73
  end
73
74
 
74
75
  private
75
- def self.comparePassword(user, password)
76
- return crypt.encrypt_and_sign(user.password) == password
76
+ def self.comparePassword(userPassword, password)
77
+ return userPassword == password
77
78
  end
78
79
 
79
80
  def self.checkTokenExpires(expires_in)
@@ -1,5 +1,5 @@
1
1
  module Sphinx
2
2
  module Oauth
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sphinx-oauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roshan