From ee3c9146e4bbe93ec1f00ee45386a82ec4363c4d Mon Sep 17 00:00:00 2001 From: Azul Date: Fri, 23 Nov 2012 12:11:11 +0100 Subject: identify user by id so rerendering the form does not use new invalid login --- users/lib/warden/strategies/secure_remote_password.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'users/lib/warden/strategies/secure_remote_password.rb') diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb index 95570e0..953e2e9 100644 --- a/users/lib/warden/strategies/secure_remote_password.rb +++ b/users/lib/warden/strategies/secure_remote_password.rb @@ -30,7 +30,7 @@ module Warden end def initialize! - user = User.find_by_param(id) + user = User.find_by_login(id) session[:handshake] = user.initialize_auth(params['A'].hex) custom! json_response(session[:handshake]) rescue RECORD_NOT_FOUND -- cgit v1.2.3 From cdda8f095d49cdda94c3527ecb92cb15c300327b Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 26 Nov 2012 12:15:54 +0100 Subject: fixed login error message on wrong username --- users/lib/warden/strategies/secure_remote_password.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'users/lib/warden/strategies/secure_remote_password.rb') diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb index 953e2e9..594e27e 100644 --- a/users/lib/warden/strategies/secure_remote_password.rb +++ b/users/lib/warden/strategies/secure_remote_password.rb @@ -30,11 +30,12 @@ module Warden end def initialize! - user = User.find_by_login(id) - session[:handshake] = user.initialize_auth(params['A'].hex) - custom! json_response(session[:handshake]) - rescue RECORD_NOT_FOUND - fail! :login => "user_not_found" + if user = User.find_by_login(id) + session[:handshake] = user.initialize_auth(params['A'].hex) + custom! json_response(session[:handshake]) + else + fail! :login => "user_not_found" + end end def json_response(object) -- cgit v1.2.3