diff options
author | Azul <azul@leap.se> | 2012-10-30 15:36:16 +0100 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-10-30 15:36:16 +0100 |
commit | f2825d10e6447ea766fee085841e2b92b0477976 (patch) | |
tree | 6f5d9774d62634ae2ff1610a9960f814387ebdb1 /users/config/initializers/warden.rb | |
parent | bcc0f11caeef1b09712b9b62e1607237885d1af5 (diff) |
sending proper error messages from warden.
still need to translate these
Diffstat (limited to 'users/config/initializers/warden.rb')
-rw-r--r-- | users/config/initializers/warden.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/users/config/initializers/warden.rb b/users/config/initializers/warden.rb index 98dd99c..82753ec 100644 --- a/users/config/initializers/warden.rb +++ b/users/config/initializers/warden.rb @@ -1,10 +1,10 @@ Rails.configuration.middleware.use RailsWarden::Manager do |config| config.default_strategies :secure_remote_password config.failure_app = SessionsController - config.default_scope = :user - config.scope_defaults :user, :action => :new end +RailsWarden.unauthenticated_action = :new + # Setup Session Serialization class Warden::SessionSerializer def serialize(record) @@ -44,7 +44,7 @@ Warden::Strategies.add(:secure_remote_password) do def validate! srp_session = session.delete(:handshake) user = srp_session.authenticate(params['client_auth'].hex) - user.nil? ? fail!("Could not log in") : success!(user) + user ? success!(user) : fail!(:password => "Could not log in") end def initialize! @@ -52,7 +52,7 @@ Warden::Strategies.add(:secure_remote_password) do session[:handshake] = user.initialize_auth(params['A'].hex) custom! json_response(session[:handshake]) rescue RECORD_NOT_FOUND - fail! "User not found!" + fail! :login => "User not found!" end def json_response(object) |