Skip to content

Commit

Permalink
User not found displays an info alert, not an error alert
Browse files Browse the repository at this point in the history
  • Loading branch information
skelz0r committed Jul 11, 2023
1 parent 63f58d2 commit 03ffe6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion app/controllers/concerns/sessions_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def login(interactor_call)
if interactor_call.success?
sign_in_and_redirect(interactor_call.user)
else
error_message(title: t(".#{interactor_call.message}.title"), description: t(".#{interactor_call.message}.description"))
send(extract_flash_kind(interactor_call.message), title: t(".#{interactor_call.message}.title"), description: t(".#{interactor_call.message}.description"))

redirect_to login_path
end
Expand Down Expand Up @@ -61,4 +61,13 @@ def oauth_logout_url
def oauth_api_gouv_client_id
Rails.configuration.public_send("oauth_api_gouv_client_id_#{namespace.gsub('api_', '')}")
end

def extract_flash_kind(message)
case message
when 'not_found'
'info_message'
else
'error_message'
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@
expect(page).to have_current_path(login_path, ignore_query: true)
end

it_behaves_like 'display alert', :error
it_behaves_like 'display alert', :info
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,6 @@
expect(page).to have_current_path(api_particulier_login_path, ignore_query: true)
end

it_behaves_like 'display alert', :error
it_behaves_like 'display alert', :info
end
end

0 comments on commit 03ffe6d

Please sign in to comment.