summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-06-24 12:16:04 +0200
committerAzul <azul@leap.se>2013-07-12 09:34:37 +0200
commit76e36080ed56c33f220509bd67a3693bf9d7567b (patch)
treefd5af3c9fb19265f31056d722d5c3743fd55e3ee
parentf0be09a92f24ddd11adb531e10c8ec6e525bf520 (diff)
print debug info on failed login attempts
-rw-r--r--users/leap_web_users.gemspec2
-rw-r--r--users/lib/warden/strategies/secure_remote_password.rb10
2 files changed, 11 insertions, 1 deletions
diff --git a/users/leap_web_users.gemspec b/users/leap_web_users.gemspec
index 013b44a..2f4b10c 100644
--- a/users/leap_web_users.gemspec
+++ b/users/leap_web_users.gemspec
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
s.add_dependency "leap_web_core", LeapWeb::VERSION
- s.add_dependency "ruby-srp", "~> 0.1.6"
+ s.add_dependency "ruby-srp", "~> 0.1.7"
s.add_dependency "rails_warden"
end
diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb
index 2dcd706..a97e795 100644
--- a/users/lib/warden/strategies/secure_remote_password.rb
+++ b/users/lib/warden/strategies/secure_remote_password.rb
@@ -28,6 +28,9 @@ module Warden
if client = validate
success!(User.find_by_login(client.username))
else
+ Rails.logger.warn "Login attempt failed."
+ Rails.logger.debug debug_info
+ Rails.logger.debug "Received: #{params['client_auth']}"
fail!(:base => "invalid_user_pass")
end
end
@@ -58,6 +61,13 @@ module Warden
def id
params["id"] || params["login"]
end
+
+ protected
+
+ def debug_info
+ JSON.pretty_generate(session[:handshake].internal_state)
+ end
+
end
end
Warden::Strategies.add :secure_remote_password,