summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/views/layouts/_messages.html.haml2
-rw-r--r--users/app/assets/javascripts/users.js4
-rw-r--r--users/app/controllers/controller_extension/authentication.rb1
-rw-r--r--users/lib/warden/strategies/secure_remote_password.rb4
4 files changed, 8 insertions, 3 deletions
diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml
index 7ff985f..3a2361e 100644
--- a/app/views/layouts/_messages.html.haml
+++ b/app/views/layouts/_messages.html.haml
@@ -3,4 +3,4 @@
- if msg.is_a?(String)
%div{:class => "alert alert-#{name == :notice ? "success" : "error"}"}
%a.close{"data-dismiss" => "alert"} ×
- = content_tag :div, format_flash(msg), :id => "flash_#{name}"
+ = content_tag :div, format_flash(msg), :id => "flash_#{name}" \ No newline at end of file
diff --git a/users/app/assets/javascripts/users.js b/users/app/assets/javascripts/users.js
index 1d05692..4195df8 100644
--- a/users/app/assets/javascripts/users.js
+++ b/users/app/assets/javascripts/users.js
@@ -41,6 +41,10 @@
var element, error, field;
if ($.isPlainObject(message) && message.errors) {
for (field in message.errors) {
+ if (field == 'base') {
+ alert_message(message.errors[field]);
+ next;
+ }
error = message.errors[field];
element = $('form input[name$="[' + field + ']"]');
if (!element) {
diff --git a/users/app/controllers/controller_extension/authentication.rb b/users/app/controllers/controller_extension/authentication.rb
index 72df7a7..6daffdb 100644
--- a/users/app/controllers/controller_extension/authentication.rb
+++ b/users/app/controllers/controller_extension/authentication.rb
@@ -10,6 +10,7 @@ module ControllerExtension::Authentication
def authentication_errors
return unless attempted_login?
errors = get_warden_errors
+ #default response to get_warden_errors is not an enumerable, so won't work if default is used
errors.inject({}) do |translated,err|
translated[err.first] = I18n.t(err.last)
translated
diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb
index f1b1a57..2dcd706 100644
--- a/users/lib/warden/strategies/secure_remote_password.rb
+++ b/users/lib/warden/strategies/secure_remote_password.rb
@@ -28,7 +28,7 @@ module Warden
if client = validate
success!(User.find_by_login(client.username))
else
- fail!({:login => "invalid_user_pass", :password => "invalid_user_pass"})
+ fail!(:base => "invalid_user_pass")
end
end
@@ -44,7 +44,7 @@ module Warden
session[:handshake] = SRP::Session.new(client, params['A'].hex)
custom! json_response(session[:handshake])
else
- fail!({:login => "invalid_user_pass", :password => "invalid_user_pass"})
+ fail! :base => 'invalid_user_pass'
end
end