Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
Fixed some issues, pull review raised.
Browse files Browse the repository at this point in the history
  • Loading branch information
nning committed Feb 25, 2014
1 parent f7b494e commit 6a03318
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class SessionsController < Devise::SessionsController

# TODO XXX THIS IS A VERY DIRTY WORKAROUND!!
if Settings.dirty_rails4_warden_workaround
# Authenticate user and create a session.
def create
# Manually do the Mailbox lookup, because I could not get
# warden.authenticate! to work.
Expand All @@ -21,7 +22,7 @@ def create
# From here it's original devise code again..
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_in_path_for(resource)
respond_with resource, location: after_sign_in_path_for(resource)
end
end

Expand Down
3 changes: 3 additions & 0 deletions app/models/mailbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
class Mailbox < ActiveRecord::Base
include Address

# Parameters, any user can change.
PARAMS = %i[email name password password_confirmation]

# Parameters, only admin or manager users can change.
PARAMS_ADMIN = PARAMS + %i[active admin domain_id mail_location quota username]

belongs_to :domain
Expand Down
6 changes: 3 additions & 3 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# session. If you need permissions, you should implement that in a before filter.
# You can also supply a hash where the value is a boolean determining whether
# or not authentication should be aborted when the value is not present.
config.authentication_keys = [ :username, :domain_id ]
config.authentication_keys = [:username, :domain_id]

# Configure parameters from the request object used for authentication. Each entry
# given should be a request method and it will automatically be passed to the
Expand All @@ -36,12 +36,12 @@
# Configure which authentication keys should be case-insensitive.
# These keys will be downcased upon creating or modifying a user and when used
# to authenticate or find a user. Default is :email.
config.case_insensitive_keys = [ :username ]
config.case_insensitive_keys = [:username]

# Configure which authentication keys should have whitespace stripped.
# These keys will have whitespace before and after removed upon creating or
# modifying a user and when used to authenticate or find a user. Default is :email.
config.strip_whitespace_keys = [ :username ]
config.strip_whitespace_keys = [:username]

# Tell if authentication through request.params is enabled. True by default.
# It can be set to an array that will enable params authentication only for the
Expand Down
2 changes: 1 addition & 1 deletion test/functional/sessions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class SessionsControllerTest < ActionController::TestCase

should respond_with :redirect
should redirect_to :new_mailbox_session
should set_the_flash.to /invalid email or password/i
should set_the_flash.to(/invalid email or password/i)
end
end
end
Expand Down

0 comments on commit 6a03318

Please sign in to comment.