FIX: Redirect away from account-created if you're logged in

This commit is contained in:
Robin Ward 2017-05-03 11:15:54 -04:00
parent 12fb20fe1b
commit 81190f5d66
2 changed files with 8 additions and 0 deletions

View File

@ -533,6 +533,8 @@ class UsersController < ApplicationController
end
def account_created
return redirect_to("/") if current_user.present?
@custom_body_class = "static-account-created"
@message = session['user_created_message'] || I18n.t('activation.missing_session')
@account_created = { message: @message }

View File

@ -2008,6 +2008,12 @@ describe UsersController do
expect(created[:username]).to be_blank
end
it "redirects when the user is logged in" do
log_in(:user)
get :account_created
expect(response).to be_redirect
end
context "when the user account is created" do
before do
session['user_created_message'] = "Donuts"