UX: improve error message for already logged in users (#11020)
This commit is contained in:
parent
e246208756
commit
9aa2723d57
|
@ -254,7 +254,7 @@ class InvitesController < ApplicationController
|
|||
|
||||
def ensure_not_logged_in
|
||||
if current_user
|
||||
flash[:error] = I18n.t("login.already_logged_in", current_user: current_user.username)
|
||||
flash[:error] = I18n.t("login.already_logged_in")
|
||||
render layout: 'no_ember'
|
||||
false
|
||||
end
|
||||
|
|
|
@ -2452,7 +2452,7 @@ en:
|
|||
missing_user_field: "You have not completed all the user fields"
|
||||
auth_complete: "Authentication is complete."
|
||||
click_to_continue: "Click here to continue."
|
||||
already_logged_in: "Oops, looks like you are attempting to accept an invitation for another user. If you are not %{current_user}, please log out and try again."
|
||||
already_logged_in: "Sorry! This invitation is intended for new users, who do not already have an existing account."
|
||||
second_factor_title: "Two-Factor Authentication"
|
||||
second_factor_description: "Please enter the required authentication code from your app:"
|
||||
second_factor_backup_description: "Please enter one of your backup codes:"
|
||||
|
|
|
@ -10,6 +10,15 @@ describe InvitesController do
|
|||
fab!(:invite) { Fabricate(:invite) }
|
||||
fab!(:user) { Fabricate(:coding_horror) }
|
||||
|
||||
it 'does not work for logged in users' do
|
||||
sign_in(Fabricate(:user))
|
||||
get "/invites/#{invite.invite_key}"
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
body = response.body
|
||||
expect(CGI.unescapeHTML(body)).to include(I18n.t("login.already_logged_in"))
|
||||
end
|
||||
|
||||
it "returns error if invite not found" do
|
||||
get "/invites/nopeNOPEnope"
|
||||
|
||||
|
|
Loading…
Reference in New Issue