Skip to content

Commit

Permalink
Merge pull request #360 from ncbo/bugfix/account-settings-access/346
Browse files Browse the repository at this point in the history
Restore access to account settings page for usernames with @ symbols
  • Loading branch information
jvendetti authored Nov 20, 2024
2 parents b8d50c1 + 273eaf9 commit 45b564f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,10 @@ def unescape_id
def verify_owner
return if current_user_admin?

if session[:user].nil? || (!session[:user].id.eql?(params[:id]) && !session[:user].username.eql?(params[:id]))
redirect_to controller: 'login', action: 'index', redirect: "/accounts/#{params[:id]}"
end
end
user = session[:user]
return if user&.id == params[:id] || user&.username == params[:id]

def get_ontology_list(ont_hash)
return '' if ont_hash.nil?

ontologies = []
ont_hash.each do |ont, checked|
ontologies << ont if checked.to_i == 1
end
ontologies.join(';')
redirect_to login_index_path(redirect: "/accounts/#{params[:id]}")
end

def validate(params)
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

resources :projects, constraints: { id: /[^\/]+/ }

resources :users, path: :accounts, constraints: { id: /[\d\w\.\-\%\+ ]+/ }
resources :users, path: :accounts, constraints: { id: /[\d\w\.\-\%\+\@ ]+/ }

resources :mappings do
member do
Expand Down

0 comments on commit 45b564f

Please sign in to comment.