mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
redirect users to sign in page after unlock, closes #1486
This commit is contained in:
parent
263e0b7692
commit
1e1e964d25
2 changed files with 4 additions and 5 deletions
|
@ -25,8 +25,7 @@ class Devise::UnlocksController < ApplicationController
|
|||
|
||||
if resource.errors.empty?
|
||||
set_flash_message :notice, :unlocked if is_navigational_format?
|
||||
sign_in(resource_name, resource)
|
||||
respond_with_navigational(resource){ redirect_to after_sign_in_path_for(resource) }
|
||||
respond_with_navigational(resource){ redirect_to new_session_path(resource) }
|
||||
else
|
||||
respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render_with_scope :new }
|
||||
end
|
||||
|
|
|
@ -80,16 +80,16 @@ class LockTest < ActionController::IntegrationTest
|
|||
|
||||
visit_user_unlock_with_token(user.unlock_token)
|
||||
|
||||
assert_current_url '/'
|
||||
assert_current_url "/users/sign_in"
|
||||
assert_contain 'Your account was successfully unlocked.'
|
||||
|
||||
assert_not user.reload.access_locked?
|
||||
end
|
||||
|
||||
test "sign in user automatically after unlocking its account" do
|
||||
test "redirect user to sign in page after unlocking its account" do
|
||||
user = create_user(:locked => true)
|
||||
visit_user_unlock_with_token(user.unlock_token)
|
||||
assert warden.authenticated?(:user)
|
||||
assert_not warden.authenticated?(:user)
|
||||
end
|
||||
|
||||
test "user should not be able to sign in when locked" do
|
||||
|
|
Loading…
Reference in a new issue