zas-service 0.0.5 → 0.0.6

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.
@@ -55,9 +55,11 @@ module Zas
55
55
  def authenticate(username, password)
56
56
  logger.info "Authenticating #{username} (table: #{table_name}, username_field: #{username_field})" if logger
57
57
  record = db[table_name].filter(username_field => username).first
58
- logger.info "Record found for #{username}" if logger
59
- tokens = [password, record[salt_field]].compact
60
- matches?(record[password_field], *tokens) if record
58
+ if record
59
+ logger.info "Record found for #{username}" if logger
60
+ tokens = [password, record[salt_field]].compact
61
+ matches?(record[password_field], *tokens)
62
+ end
61
63
  end
62
64
 
63
65
  private
@@ -73,7 +73,7 @@ module Zas
73
73
  authenticator = authenticators[req.strategy]
74
74
  raise "No authenticator found for #{req.strategy}" unless authenticator
75
75
  authenticator.logger ||= logger
76
- {:authenticated? => authenticator.authenticate(req.credentials)}
76
+ {:authenticated? => (authenticator.authenticate(req.credentials) || false)}
77
77
  rescue => e
78
78
  logger.info "Error authenticating: #{e.message}"
79
79
  {:error => e.message}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zas-service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: