mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-23 15:19:38 +02:00
Fix account param safety
This commit is contained in:
parent
253ae29da0
commit
9aa9f99810
3 changed files with 11 additions and 7 deletions
|
@ -33,8 +33,12 @@ class AccountsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_type_class
|
def account_type_class
|
||||||
params[:type].constantize
|
valid_account_types = %w[Checking CreditCard]
|
||||||
rescue
|
|
||||||
|
if params[:type].present? && valid_account_types.include?(params[:type])
|
||||||
|
params[:type].constantizes
|
||||||
|
else
|
||||||
Account # Default to Account if type is not provided or invalid
|
Account # Default to Account if type is not provided or invalid
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,9 +6,9 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :accounts
|
resources :accounts
|
||||||
|
|
||||||
scope 'accounts/new' do
|
scope "accounts/new" do
|
||||||
scope 'bank' do
|
scope "bank" do
|
||||||
get '', to: 'accounts#new_bank', as: 'new_bank'
|
get "", to: "accounts#new_bank", as: "new_bank"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue