mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge pull request #2634 from gregates/bug/confirmation_workflow
Tweaks confirmation flow for signed_in users
This commit is contained in:
commit
c323065b57
3 changed files with 17 additions and 3 deletions
|
@ -36,6 +36,10 @@ class Devise::ConfirmationsController < DeviseController
|
|||
|
||||
# The path used after confirmation.
|
||||
def after_confirmation_path_for(resource_name, resource)
|
||||
new_session_path(resource_name)
|
||||
if signed_in?
|
||||
signed_in_root_path(resource)
|
||||
else
|
||||
new_session_path(resource_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
en:
|
||||
devise:
|
||||
confirmations:
|
||||
confirmed: "Your account was successfully confirmed. Please sign in."
|
||||
confirmed: "Your account was successfully confirmed."
|
||||
send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
|
||||
failure:
|
||||
|
|
|
@ -56,7 +56,7 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
|||
assert_not user.confirmed?
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
|
||||
assert_contain 'Your account was successfully confirmed. Please sign in.'
|
||||
assert_contain 'Your account was successfully confirmed.'
|
||||
assert_current_url '/users/sign_in'
|
||||
assert user.reload.confirmed?
|
||||
end
|
||||
|
@ -123,6 +123,16 @@ class ConfirmationTest < ActionDispatch::IntegrationTest
|
|||
end
|
||||
end
|
||||
|
||||
test 'unconfirmed but signed in user should be redirected to their root path' do
|
||||
swap Devise, :allow_unconfirmed_access_for => 1.day do
|
||||
user = sign_in_as_user(:confirm => false)
|
||||
|
||||
visit_user_confirmation_with_token(user.raw_confirmation_token)
|
||||
assert_contain 'Your account was successfully confirmed.'
|
||||
assert_current_url '/'
|
||||
end
|
||||
end
|
||||
|
||||
test 'error message is configurable by resource name' do
|
||||
store_translations :en, :devise => {
|
||||
:failure => { :user => { :unconfirmed => "Not confirmed user" } }
|
||||
|
|
Loading…
Add table
Reference in a new issue