sphinx-oauth 1.0.2 → 1.0.3

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: b2c67f40a79256137a8d751d792e036caff0886f
4
- data.tar.gz: 3eea3b90bdc303a437117b22beadf1064cd8f840
3
+ metadata.gz: 820bfd10be3e8015537fec6c1795b8904195a56f
4
+ data.tar.gz: c01429a77be3fe0276ff8ee16c235e8d8ab74fc6
5
5
  SHA512:
6
- metadata.gz: 51ed8682ca1682d24171b42b9d0039d8a2b53075ecbf0aee4e0ff5e9d7d2f0131734145871916f5fb0d0fe7276215d9e8091ced0ede8902195c5a9e39bdf27e9
7
- data.tar.gz: 07d0ae87af0ba1197cb281c13580db78b559be1a655211ef5336e59a76b3f3c45eebf4de37e7017a95c81db71cd47a42fff4079e5888ee73814341268ab39df8
6
+ metadata.gz: 5910fada1e662d9e00ffc1e879ec3bd0687ca8fcc9c82693c36f08131c3238f923d3ee1527bbc8d2c2411aa10bc170eff6f0e5e3a019aab51eb1b559b0e45157
7
+ data.tar.gz: 6c3a6b8632f4f989f8ff98fa0875601546fbd8f7baefbc41a83984857befd473ba78713639da45c1fda77d34a6e2a121d06a174358c01ba56988dc477b2d8cb2
data/lib/sphinx/oauth.rb CHANGED
@@ -5,10 +5,9 @@ module Sphinx
5
5
  def self.generateAccessToken(email, password, authorization, grant_type)
6
6
  if(grant_type.present? && grant_type == "password")
7
7
  if(checkValidRequest(authorization) && email.present? && password.present?)
8
- user = User.find_by_email(email)
8
+ user = User.find_by_email(email)
9
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
+ if(user.present? && comparePassword(crypt, user.password, password))
12
11
  oauthAccessToken = OauthAccessToken.find_by_user_name(email)
13
12
  if(!oauthAccessToken.present?)
14
13
  token = SecureRandom.uuid
@@ -73,8 +72,9 @@ module Sphinx
73
72
  end
74
73
 
75
74
  private
76
- def self.comparePassword(userPassword, password)
77
- return userPassword == password
75
+ def self.comparePassword(crypt, userPassword, password)
76
+ user_password = crypt.encrypt_and_sign(userPassword)
77
+ return user_password == password
78
78
  end
79
79
 
80
80
  def self.checkTokenExpires(expires_in)
@@ -1,5 +1,5 @@
1
1
  module Sphinx
2
2
  module Oauth
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
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.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roshan